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 namespace i = ::v8::internal;
49 static v8::Handle<Value> handle_property(Local<String> name,
57 v8::HandleScope scope;
58 Local<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
70 static v8::Handle<Value> GetIntValue(Local<String> property,
74 static_cast<int*>(v8::Handle<v8::External>::Cast(info.Data())->Value());
83 static_cast<int*>(v8::Handle<v8::External>::Cast(info.Data())->Value());
93 v8::HandleScope scope;
94 v8::Handle<v8::FunctionTemplate> templ = v8::FunctionTemplate::New();
98 v8::External::New(&foo));
102 v8::External::New(&bar));
106 v8::External::New(&baz));
115 static v8::Handle<v8::Object> x_receiver;
116 static v8::Handle<v8::Object> x_holder;
119 static v8::Handle<Value> XGetter(Local<String> name, const AccessorInfo& info) {
137 v8::HandleScope scope;
138 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
143 x_receiver = v8::Object::New();
145 v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(CompileRun(
155 v8::Handle<Value> entry = array->Get(v8::Integer::New(i));
156 CHECK_EQ(v8::Integer::New(i), entry);
161 static v8::Handle<Value> AccessorProhibitsOverwritingGetter(
165 return v8::True();
170 v8::HandleScope scope;
176 v8::Handle<Value>(),
177 v8::PROHIBITS_OVERWRITING,
178 v8::ReadOnly);
179 Local<v8::Object> instance = templ->NewInstance();
209 static v8::Handle<Value> HandleAllocatingGetter(Local<String> name,
213 v8::String::New("foo");
214 return v8::String::New("foo");
219 v8::HandleScope scope;
220 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
224 v8::Handle<v8::Object> inst = obj->NewInstance();
225 context->Global()->Set(v8::String::New("obj"), inst);
228 v8::HandleScope scope;
239 static v8::Handle<Value> CheckAccessorArgsCorrect(Local<String> name,
242 CHECK(info.Data()->Equals(v8::String::New("data")));
245 CHECK(info.Data()->Equals(v8::String::New("data")));
248 CHECK(info.Data()->Equals(v8::String::New("data")));
249 return v8::Integer::New(17);
253 v8::HandleScope scope;
254 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
258 v8::String::New("data"));
260 v8::Handle<v8::Object> inst = obj->NewInstance();
261 context->Global()->Set(v8::String::New("obj"), inst);
262 Local<Script> scr = v8::Script::Compile(v8::String::New("obj.xxx"));
270 static v8::Handle<Value> EmptyGetter(Local<String> name,
275 return v8::Handle<v8::Value>();
279 v8::HandleScope scope;
280 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
281 obj->SetAccessor(v8_str("xxx"), EmptyGetter, NULL, v8::String::New("data"));
283 v8::Handle<v8::Object> inst = obj->NewInstance();
284 context->Global()->Set(v8::String::New("obj"), inst);
285 Local<Script> scr = v8::Script::Compile(v8::String::New("obj.xxx"));
288 CHECK(result == v8::Undefined());
296 v8::HandleScope scope;
298 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
299 obj->SetAccessor(v8_str("xxx"), EmptyGetter, NULL, v8::String::New("data"));
301 v8::Handle<v8::Object> inst = obj->NewInstance();
302 context->Global()->Set(v8::String::New("obj"), inst);
303 Local<Script> scr = v8::Script::Compile(v8::String::New("obj.xxx"));
306 CHECK(result == v8::Undefined());
310 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
314 v8::String::New("data"));
316 v8::Handle<v8::Object> inst = obj->NewInstance();
317 context->Global()->Set(v8::String::New("obj"), inst);
318 Local<Script> scr = v8::Script::Compile(v8::String::New("obj.xxx"));
327 static v8::Handle<Value> ThrowingGetAccessor(Local<String> name,
330 return v8::ThrowException(v8_str("g"));
337 v8::ThrowException(value);
342 v8::HandleScope scope;
343 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
354 v8::Handle<Value> result;
371 static v8::Handle<Value> AllocGetter(Local<String> name,
374 return v8::Array::New(1000);
379 v8::HandleScope scope;
380 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
394 static v8::Handle<Value> StackCheck(Local<String> name,
406 return v8::Undefined();
411 v8::HandleScope scope;
412 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
427 static v8::Handle<Value> AllocateHandles(Local<String> name,
430 v8::Local<v8::Value>::New(name);
432 return v8::Integer::New(100);
439 v8::HandleScope scope;
440 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
444 v8::Handle<v8::Value> result = Script::Compile(String::New(