]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - runtime/ErrorInstance.cpp
JavaScriptCore-7600.1.4.15.12.tar.gz
[apple/javascriptcore.git] / runtime / ErrorInstance.cpp
index 91a6fc40eab8117d6c51c90fb2d083aeb38ccb8c..42e7c533c9b24da34e94c3900c2605c900340044 100644 (file)
 #include "config.h"
 #include "ErrorInstance.h"
 
+#include "JSScope.h"
+#include "JSCInlines.h"
+
 namespace JSC {
 
-ASSERT_HAS_TRIVIAL_DESTRUCTOR(ErrorInstance);
+STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(ErrorInstance);
 
 const ClassInfo ErrorInstance::s_info = { "Error", &JSNonFinalObject::s_info, 0, 0, CREATE_METHOD_TABLE(ErrorInstance) };
 
-ErrorInstance::ErrorInstance(JSGlobalData& globalData, Structure* structure)
-    : JSNonFinalObject(globalData, structure)
+ErrorInstance::ErrorInstance(VM& vm, Structure* structure)
+    : JSNonFinalObject(vm, structure)
     , m_appendSourceToMessage(false)
 {
 }
 
+void ErrorInstance::finishCreation(VM& vm, const String& message, Vector<StackFrame> stackTrace)
+{
+    Base::finishCreation(vm);
+    ASSERT(inherits(info()));
+    if (!message.isNull())
+        putDirect(vm, vm.propertyNames->message, jsString(&vm, message), DontEnum);
+    
+    if (!stackTrace.isEmpty())
+        putDirect(vm, vm.propertyNames->stack, vm.interpreter->stackTraceAsString(vm.topCallFrame, stackTrace), DontEnum);
+}
+    
 } // namespace JSC