Home | History | Annotate | Download | only in v8

Lines Matching refs:V8

65 #include <v8-debug.h>
66 #include <v8.h>
69 #include <v8/src/extensions/experimental/i18n-extension.h>
87 // FIXME: We temporarily deal with V8 internal error situations
94 // V8 is shutdown, we cannot use V8 api.
101 printf("V8 error: %s (%s). Current memory usage: %d MB\n", message, location, memoryUsageMB);
105 static void v8UncaughtExceptionHandler(v8::Handle<v8::Message> message, v8::Handle<v8::Value> data)
112 v8::Handle<v8::String> errorMessageString = message->Get();
116 v8::Handle<v8::StackTrace> stackTrace = message->GetStackTrace();
122 v8::Handle<v8::Value> resourceName = message->GetScriptResourceName();
131 static Frame* getTargetFrame(v8::Local<v8::Object> host, v8::Local<v8::Value> data)
136 v8::Handle<v8::Object> window = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), host);
152 static void reportUnsafeJavaScriptAccess(v8::Local<v8::Object> host, v8::AccessType type, v8::Local<v8::Value> data)
185 // garbage. Notify V8 about this so it'll have a chance of cleaning
192 v8::Persistent<v8::Object> wrapper = it->second;
213 v8::HandleScope handleScope;
223 v8::HandleScope handle;
226 v8::Context::Scope contextScope(m_context);
234 v8::Handle<v8::Object> wrapper = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), m_global);
257 // instance to a V8 object, we return the shadow object.
291 v8::HandleScope handleScope;
297 // Tells V8 not to call the default OOM handler, binding code
299 v8::V8::IgnoreOutOfMemoryException();
300 v8::V8::SetFatalErrorHandler(reportFatalErrorInV8);
302 v8::V8::SetGlobalGCPrologueCallback(&V8GCController::gcPrologue);
303 v8::V8::SetGlobalGCEpilogueCallback(&V8GCController::gcEpilogue);
305 v8::V8::AddMessageListener(&v8UncaughtExceptionHandler);
307 v8::V8::SetFailedAccessCheckCallbackFunction(reportUnsafeJavaScriptAccess);
319 v8::Local<v8::Context> v8Context = v8::Local<v8::Context>::New(m_context);
320 v8::Context::Scope contextScope(v8Context);
324 m_global = v8::Persistent<v8::Object>::New(v8Context->Global());
362 v8::Persistent<v8::Context> V8DOMWindowShell::createNewContext(v8::Handle<v8::Object> global, int extensionGroup)
364 v8::Persistent<v8::Context> result;
372 v8::Persistent<v8::ObjectTemplate> globalTemplate = V8DOMWindow::GetShadowObjectTemplate();
381 // Enables experimental i18n API in V8.
382 if (RuntimeEnabledFeatures::javaScriptI18NAPIEnabled() && !V8Proxy::registeredExtensionWithV8(v8::internal::I18NExtension::get()))
383 V8Proxy::registerExtension(v8::internal::I18NExtension::get());
386 // Dynamically tell v8 about our extensions now.
398 v8::ExtensionConfiguration extensionConfiguration(index, extensionNames.get());
399 result = v8::Context::New(&extensionConfiguration, globalTemplate, global);
404 void V8DOMWindowShell::setContext(v8::Handle<v8::Context> context)
411 m_context = v8::Persistent<v8::Context>::New(context);
414 bool V8DOMWindowShell::installDOMWindow(v8::Handle<v8::Context> context, DOMWindow* window)
417 v8::Handle<v8::Function> windowConstructor = V8DOMWrapper::getConstructor(&V8DOMWindow::info, getHiddenObjectPrototype(context));
418 v8::Local<v8::Object> jsWindow = SafeAllocation::newInstance(windowConstructor);
425 V8DOMWrapper::setDOMWrapper(v8::Handle<v8::Object>::Cast(jsWindow->GetPrototype()), &V8DOMWindow::info, window);
428 V8DOMWrapper::setJSWrapperForDOMObject(window, v8::Persistent<v8::Object>::New(jsWindow));
431 v8::Handle<v8::Object> v8RealGlobal = v8::Handle<v8::Object>::Cast(context->Global()->GetPrototype());
437 void V8DOMWindowShell::updateDocumentWrapper(v8::Handle<v8::Object> wrapper)
442 m_document = v8::Persistent<v8::Object>::New(wrapper);
459 static void checkDocumentWrapper(v8::Handle<v8::Object> wrapper, Document* document)
462 ASSERT(!document->isHTMLDocument() || (V8Document::toNative(v8::Handle<v8::Object>::Cast(wrapper->GetPrototype())) == document));
467 v8::HandleScope handleScope;
468 v8::Context::Scope contextScope(m_context);
482 v8::Handle<v8::Value> documentWrapper = toV8(m_frame->document());
485 updateDocumentWrapper(v8::Handle<v8::Object>::Cast(documentWrapper));
495 m_context->Global()->ForceSet(v8::String::New("document"), documentWrapper, static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete));
501 m_context->Global()->ForceDelete(v8::String::New("document"));
534 // NOTE: V8 does identity comparison in fast path, must use a symbol
536 m_context->SetSecurityToken(v8::String::NewSymbol(utf8Token.data(), utf8Token.length()));
564 v8::Handle<v8::Value> getter(v8::Local<v8::String> property, const v8::AccessorInfo& info)
570 v8::Handle<v8::Value> result = V8HTMLDocument::GetNamedProperty(htmlDocument, name);
573 v8::Handle<v8::Value> prototype = info.Holder()->GetPrototype();
575 return prototype.As<v8::Object>()->Get(property);
576 return v8::Undefined();
583 v8::HandleScope handleScope;
584 v8::Context::Scope contextScope(m_context);
597 v8::HandleScope scope;
601 v8::Handle<v8::Value> V8DOMWindowShell::getHiddenObjectPrototype(v8::Handle<v8::Context> context)
606 bool V8DOMWindowShell::installHiddenObjectPrototype(v8::Handle<v8::Context> context)
608 v8::Handle<v8::String> objectString = v8::String::New("Object");
609 v8::Handle<v8::String> prototypeString = v8::String::New("prototype");
610 v8::Handle<v8::String> hiddenObjectPrototypeString = V8HiddenPropertyName::objectPrototype();
615 v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(context->Global()->Get(objectString));
619 v8::Handle<v8::Value> objectPrototype = object->Get(prototypeString);
629 v8::Local<v8::Object> V8DOMWindowShell::createWrapperFromCacheSlowCase(WrapperTypeInfo* type)
633 v8::Context::Scope scope(m_context);
634 v8::Local<v8::Function> function = V8DOMWrapper::getConstructor(type, getHiddenObjectPrototype(m_context));
635 v8::Local<v8::Object> instance = SafeAllocation::newInstance(function);
637 m_wrapperBoilerplates.set(type, v8::Persistent<v8::Object>::New(instance));