Lines Matching refs:v8
1 // Copyright 2012 the V8 project authors. All rights reserved.
31 #include "v8.h"
41 using namespace v8::internal;
43 static v8::Persistent<v8::Context> env;
47 class PrintExtension : public v8::Extension {
49 PrintExtension() : v8::Extension("v8/print", kSource) { }
50 virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction(
51 v8::Handle<v8::String> name);
52 static v8::Handle<v8::Value> Print(const v8::Arguments& args);
61 v8::Handle<v8::FunctionTemplate> PrintExtension::GetNativeFunction(
62 v8::Handle<v8::String> str) {
63 return v8::FunctionTemplate::New(PrintExtension::Print);
67 v8::Handle<v8::Value> PrintExtension::Print(const v8::Arguments& args) {
70 v8::HandleScope scope;
71 v8::Handle<v8::Value> arg = args[i];
72 v8::Handle<v8::String> string_obj = arg->ToString();
82 return v8::Undefined();
87 v8::DeclareExtension kPrintExtensionDeclaration(&kPrintExtension);
92 v8::HandleScope scope;
93 const char* extensions[] = { "v8/print", "v8/gc" };
94 v8::ExtensionConfiguration config(2, extensions);
95 env = v8::Context::New(&config);
97 v8::HandleScope scope;
150 v8::HandleScope scope;
171 v8::HandleScope scope;
191 v8::HandleScope scope;
212 v8::HandleScope scope;
219 v8::HandleScope scope;
234 v8::HandleScope scope;
266 v8::HandleScope scope;
288 v8::HandleScope scope;
321 v8::HandleScope scope;
333 v8::HandleScope scope;
334 v8::ScriptOrigin origin = v8::ScriptOrigin(v8::String::New("test"));
346 v8::Handle<v8::String> script_body = v8::String::New(buffer.start());
347 v8::Script::Compile(script_body, &origin)->Run();
348 v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(
349 env->Global()->Get(v8::String::New("f")));
356 static Handle<JSFunction> GetJSFunction(v8::Handle<v8::Object> obj,
358 v8::Local<v8::Function> fun =
359 v8::Local<v8::Function>::Cast(obj->Get(v8_str(property_name)));
360 return v8::Utils::OpenHandle(*fun);
376 v8::internal::EmbeddedVector<char, 128> decode_buffer;
393 v8::HandleScope scope;