Lines Matching refs:v8
1 // Copyright 2009 the V8 project authors. All rights reserved.
30 #include "v8.h"
37 using ::v8::ObjectTemplate;
38 using ::v8::Value;
39 using ::v8::Context;
40 using ::v8::Local;
41 using ::v8::String;
42 using ::v8::Script;
43 using ::v8::Function;
44 using ::v8::AccessorInfo;
45 using ::v8::Extension;
47 static v8::Handle<Value> handle_property(Local<String> name,
55 v8::HandleScope scope;
56 Local<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
68 static v8::Handle<Value> GetIntValue(Local<String> property,
72 static_cast<int*>(v8::Handle<v8::External>::Cast(info.Data())->Value());
81 static_cast<int*>(v8::Handle<v8::External>::Cast(info.Data())->Value());
91 v8::HandleScope scope;
92 v8::Handle<v8::FunctionTemplate> templ = v8::FunctionTemplate::New();
96 v8::External::New(&foo));
100 v8::External::New(&bar));
104 v8::External::New(&baz));
113 static v8::Handle<v8::Object> x_receiver;
114 static v8::Handle<v8::Object> x_holder;
117 static v8::Handle<Value> XGetter(Local<String> name, const AccessorInfo& info) {
135 v8::HandleScope scope;
136 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
141 x_receiver = v8::Object::New();
143 v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(CompileRun(
153 v8::Handle<Value> entry = array->Get(v8::Integer::New(i));
154 CHECK_EQ(v8::Integer::New(i), entry);
159 static v8::Handle<Value> AccessorProhibitsOverwritingGetter(
163 return v8::True();
168 v8::HandleScope scope;
174 v8::Handle<Value>(),
175 v8::PROHIBITS_OVERWRITING,
176 v8::ReadOnly);
177 Local<v8::Object> instance = templ->NewInstance();
207 static v8::Handle<Value> HandleAllocatingGetter(Local<String> name,
211 v8::String::New("foo");
212 return v8::String::New("foo");
217 v8::HandleScope scope;
218 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
222 v8::Handle<v8::Object> inst = obj->NewInstance();
223 context->Global()->Set(v8::String::New("obj"), inst);
226 v8::HandleScope scope;
237 static v8::Handle<Value> CheckAccessorArgsCorrect(Local<String> name,
240 CHECK(info.Data()->Equals(v8::String::New("data")));
243 CHECK(info.Data()->Equals(v8::String::New("data")));
246 CHECK(info.Data()->Equals(v8::String::New("data")));
247 return v8::Integer::New(17);
251 v8::HandleScope scope;
252 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
256 v8::String::New("data"));
258 v8::Handle<v8::Object> inst = obj->NewInstance();
259 context->Global()->Set(v8::String::New("obj"), inst);
260 Local<Script> scr = v8::Script::Compile(v8::String::New("obj.xxx"));
268 static v8::Handle<Value> EmptyGetter(Local<String> name,
273 return v8::Handle<v8::Value>();
277 v8::HandleScope scope;
278 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
279 obj->SetAccessor(v8_str("xxx"), EmptyGetter, NULL, v8::String::New("data"));
281 v8::Handle<v8::Object> inst = obj->NewInstance();
282 context->Global()->Set(v8::String::New("obj"), inst);
283 Local<Script> scr = v8::Script::Compile(v8::String::New("obj.xxx"));
286 CHECK(result == v8::Undefined());
294 v8::HandleScope scope;
296 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
297 obj->SetAccessor(v8_str("xxx"), EmptyGetter, NULL, v8::String::New("data"));
299 v8::Handle<v8::Object> inst = obj->NewInstance();
300 context->Global()->Set(v8::String::New("obj"), inst);
301 Local<Script> scr = v8::Script::Compile(v8::String::New("obj.xxx"));
304 CHECK(result == v8::Undefined());
308 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
312 v8::String::New("data"));
314 v8::Handle<v8::Object> inst = obj->NewInstance();
315 context->Global()->Set(v8::String::New("obj"), inst);
316 Local<Script> scr = v8::Script::Compile(v8::String::New("obj.xxx"));
325 static v8::Handle<Value> ThrowingGetAccessor(Local<String> name,
328 return v8::ThrowException(v8_str("g"));
335 v8::ThrowException(value);
340 v8::HandleScope scope;
341 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
352 v8::Handle<Value> result;
369 static v8::Handle<Value> AllocGetter(Local<String> name,
372 return v8::Array::New(1000);
377 v8::HandleScope scope;
378 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
392 static v8::Handle<Value> StackCheck(Local<String> name,
404 return v8::Undefined();
409 v8::HandleScope scope;
410 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
425 static v8::Handle<Value> AllocateHandles(Local<String> name,
428 v8::Local<v8::Value>::New(name);
430 return v8::Integer::New(100);
437 v8::HandleScope scope;
438 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
442 v8::Handle<v8::Value> result = Script::Compile(String::New(