Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: test/cctest/test-api.cc

Issue 660243: Small API improvements: (Closed)
Patch Set: Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« src/runtime.cc ('K') | « src/runtime.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. 1 // Copyright 2007-2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 CHECK(foo_before->IsUndefined()); 257 CHECK(foo_before->IsUndefined());
258 Local<String> bar_str = v8_str("bar"); 258 Local<String> bar_str = v8_str("bar");
259 obj->Set(v8_str("foo"), bar_str); 259 obj->Set(v8_str("foo"), bar_str);
260 Local<Value> foo_after = obj->Get(v8_str("foo")); 260 Local<Value> foo_after = obj->Get(v8_str("foo"));
261 CHECK(!foo_after->IsUndefined()); 261 CHECK(!foo_after->IsUndefined());
262 CHECK(foo_after->IsString()); 262 CHECK(foo_after->IsString());
263 CHECK_EQ(bar_str, foo_after); 263 CHECK_EQ(bar_str, foo_after);
264 } 264 }
265 265
266 266
267 THREADED_TEST(AccessElement) {
268 v8::HandleScope scope;
269 LocalContext env;
270 Local<v8::Object> obj = v8::Object::New();
271 Local<Value> before = obj->Get(1);
272 CHECK(before->IsUndefined());
273 Local<String> bar_str = v8_str("bar");
274 obj->Set(1, bar_str);
275 Local<Value> after = obj->Get(1);
276 CHECK(!after->IsUndefined());
277 CHECK(after->IsString());
278 CHECK_EQ(bar_str, after);
279
280 Local<v8::Array> value = CompileRun("[\"a\", \"b\"]").As<v8::Array>();
281 CHECK_EQ(v8_str("a"), value->Get(0));
282 CHECK_EQ(v8_str("b"), value->Get(1));
283 }
284
285
267 THREADED_TEST(Script) { 286 THREADED_TEST(Script) {
268 v8::HandleScope scope; 287 v8::HandleScope scope;
269 LocalContext env; 288 LocalContext env;
270 const char* c_source = "1 + 2 + 3"; 289 const char* c_source = "1 + 2 + 3";
271 Local<String> source = String::New(c_source); 290 Local<String> source = String::New(c_source);
272 Local<Script> script = Script::Compile(source); 291 Local<Script> script = Script::Compile(source);
273 CHECK_EQ(6, script->Run()->Int32Value()); 292 CHECK_EQ(6, script->Run()->Int32Value());
274 } 293 }
275 294
276 295
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after
1247 const v8::Arguments& args) { 1266 const v8::Arguments& args) {
1248 ApiTestFuzzer::Fuzz(); 1267 ApiTestFuzzer::Fuzz();
1249 int depth = args.This()->Get(v8_str("depth"))->Int32Value(); 1268 int depth = args.This()->Get(v8_str("depth"))->Int32Value();
1250 if (depth == kTargetRecursionDepth) { 1269 if (depth == kTargetRecursionDepth) {
1251 printf("[depth = %d]\n", depth); 1270 printf("[depth = %d]\n", depth);
1252 return v8::Undefined(); 1271 return v8::Undefined();
1253 } 1272 }
1254 args.This()->Set(v8_str("depth"), v8::Integer::New(depth + 1)); 1273 args.This()->Set(v8_str("depth"), v8::Integer::New(depth + 1));
1255 v8::Handle<Value> function = 1274 v8::Handle<Value> function =
1256 args.This()->Get(v8_str("callFunctionRecursively")); 1275 args.This()->Get(v8_str("callFunctionRecursively"));
1257 return v8::Handle<Function>::Cast(function)->Call(args.This(), 0, NULL); 1276 return function.As<Function>()->Call(args.This(), 0, NULL);
1258 } 1277 }
1259 1278
1260 1279
1261 THREADED_TEST(DeepCrossLanguageRecursion) { 1280 THREADED_TEST(DeepCrossLanguageRecursion) {
1262 v8::HandleScope scope; 1281 v8::HandleScope scope;
1263 v8::Handle<v8::ObjectTemplate> global = ObjectTemplate::New(); 1282 v8::Handle<v8::ObjectTemplate> global = ObjectTemplate::New();
1264 global->Set(v8_str("callScriptRecursively"), 1283 global->Set(v8_str("callScriptRecursively"),
1265 v8::FunctionTemplate::New(CallScriptRecursivelyCall)); 1284 v8::FunctionTemplate::New(CallScriptRecursivelyCall));
1266 global->Set(v8_str("callFunctionRecursively"), 1285 global->Set(v8_str("callFunctionRecursively"),
1267 v8::FunctionTemplate::New(CallFunctionRecursivelyCall)); 1286 v8::FunctionTemplate::New(CallFunctionRecursivelyCall));
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 CHECK_EQ(17, obj->GetInternalField(0)->Int32Value()); 1352 CHECK_EQ(17, obj->GetInternalField(0)->Int32Value());
1334 } 1353 }
1335 1354
1336 1355
1337 THREADED_TEST(GlobalObjectInternalFields) { 1356 THREADED_TEST(GlobalObjectInternalFields) {
1338 v8::HandleScope scope; 1357 v8::HandleScope scope;
1339 Local<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(); 1358 Local<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
1340 global_template->SetInternalFieldCount(1); 1359 global_template->SetInternalFieldCount(1);
1341 LocalContext env(NULL, global_template); 1360 LocalContext env(NULL, global_template);
1342 v8::Handle<v8::Object> global_proxy = env->Global(); 1361 v8::Handle<v8::Object> global_proxy = env->Global();
1343 v8::Handle<v8::Object> global = 1362 v8::Handle<v8::Object> global = global_proxy->GetPrototype().As<v8::Object>();
1344 v8::Handle<v8::Object>::Cast(global_proxy->GetPrototype());
1345 CHECK_EQ(1, global->InternalFieldCount()); 1363 CHECK_EQ(1, global->InternalFieldCount());
1346 CHECK(global->GetInternalField(0)->IsUndefined()); 1364 CHECK(global->GetInternalField(0)->IsUndefined());
1347 global->SetInternalField(0, v8_num(17)); 1365 global->SetInternalField(0, v8_num(17));
1348 CHECK_EQ(17, global->GetInternalField(0)->Int32Value()); 1366 CHECK_EQ(17, global->GetInternalField(0)->Int32Value());
1349 } 1367 }
1350 1368
1351 1369
1352 THREADED_TEST(InternalFieldsNativePointers) { 1370 THREADED_TEST(InternalFieldsNativePointers) {
1353 v8::HandleScope scope; 1371 v8::HandleScope scope;
1354 LocalContext env; 1372 LocalContext env;
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1522 } 1540 }
1523 1541
1524 1542
1525 THREADED_TEST(External) { 1543 THREADED_TEST(External) {
1526 v8::HandleScope scope; 1544 v8::HandleScope scope;
1527 int x = 3; 1545 int x = 3;
1528 Local<v8::External> ext = v8::External::New(&x); 1546 Local<v8::External> ext = v8::External::New(&x);
1529 LocalContext env; 1547 LocalContext env;
1530 env->Global()->Set(v8_str("ext"), ext); 1548 env->Global()->Set(v8_str("ext"), ext);
1531 Local<Value> reext_obj = Script::Compile(v8_str("this.ext"))->Run(); 1549 Local<Value> reext_obj = Script::Compile(v8_str("this.ext"))->Run();
1532 v8::Handle<v8::External> reext = v8::Handle<v8::External>::Cast(reext_obj); 1550 v8::Handle<v8::External> reext = reext_obj.As<v8::External>();
1533 int* ptr = static_cast<int*>(reext->Value()); 1551 int* ptr = static_cast<int*>(reext->Value());
1534 CHECK_EQ(x, 3); 1552 CHECK_EQ(x, 3);
1535 *ptr = 10; 1553 *ptr = 10;
1536 CHECK_EQ(x, 10); 1554 CHECK_EQ(x, 10);
1537 1555
1538 // Make sure unaligned pointers are wrapped properly. 1556 // Make sure unaligned pointers are wrapped properly.
1539 char* data = i::StrDup("0123456789"); 1557 char* data = i::StrDup("0123456789");
1540 Local<v8::Value> zero = v8::External::Wrap(&data[0]); 1558 Local<v8::Value> zero = v8::External::Wrap(&data[0]);
1541 Local<v8::Value> one = v8::External::Wrap(&data[1]); 1559 Local<v8::Value> one = v8::External::Wrap(&data[1]);
1542 Local<v8::Value> two = v8::External::Wrap(&data[2]); 1560 Local<v8::Value> two = v8::External::Wrap(&data[2]);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1654 Script::Compile(v8_str("delete dont_delete"))->Run(); 1672 Script::Compile(v8_str("delete dont_delete"))->Run();
1655 CHECK_EQ(13, context->Global()->Get(prop)->Int32Value()); 1673 CHECK_EQ(13, context->Global()->Get(prop)->Int32Value());
1656 } 1674 }
1657 1675
1658 1676
1659 THREADED_TEST(Array) { 1677 THREADED_TEST(Array) {
1660 v8::HandleScope scope; 1678 v8::HandleScope scope;
1661 LocalContext context; 1679 LocalContext context;
1662 Local<v8::Array> array = v8::Array::New(); 1680 Local<v8::Array> array = v8::Array::New();
1663 CHECK_EQ(0, array->Length()); 1681 CHECK_EQ(0, array->Length());
1664 CHECK(array->Get(v8::Integer::New(0))->IsUndefined()); 1682 CHECK(array->Get(0)->IsUndefined());
1665 CHECK(!array->Has(0)); 1683 CHECK(!array->Has(0));
1666 CHECK(array->Get(v8::Integer::New(100))->IsUndefined()); 1684 CHECK(array->Get(100)->IsUndefined());
1667 CHECK(!array->Has(100)); 1685 CHECK(!array->Has(100));
1668 array->Set(v8::Integer::New(2), v8_num(7)); 1686 array->Set(2, v8_num(7));
1669 CHECK_EQ(3, array->Length()); 1687 CHECK_EQ(3, array->Length());
1670 CHECK(!array->Has(0)); 1688 CHECK(!array->Has(0));
1671 CHECK(!array->Has(1)); 1689 CHECK(!array->Has(1));
1672 CHECK(array->Has(2)); 1690 CHECK(array->Has(2));
1673 CHECK_EQ(7, array->Get(v8::Integer::New(2))->Int32Value()); 1691 CHECK_EQ(7, array->Get(2)->Int32Value());
1674 Local<Value> obj = Script::Compile(v8_str("[1, 2, 3]"))->Run(); 1692 Local<Value> obj = Script::Compile(v8_str("[1, 2, 3]"))->Run();
1675 Local<v8::Array> arr = Local<v8::Array>::Cast(obj); 1693 Local<v8::Array> arr = obj.As<v8::Array>();
1676 CHECK_EQ(3, arr->Length()); 1694 CHECK_EQ(3, arr->Length());
1677 CHECK_EQ(1, arr->Get(v8::Integer::New(0))->Int32Value()); 1695 CHECK_EQ(1, arr->Get(0)->Int32Value());
1678 CHECK_EQ(2, arr->Get(v8::Integer::New(1))->Int32Value()); 1696 CHECK_EQ(2, arr->Get(1)->Int32Value());
1679 CHECK_EQ(3, arr->Get(v8::Integer::New(2))->Int32Value()); 1697 CHECK_EQ(3, arr->Get(2)->Int32Value());
1680 } 1698 }
1681 1699
1682 1700
1683 v8::Handle<Value> HandleF(const v8::Arguments& args) { 1701 v8::Handle<Value> HandleF(const v8::Arguments& args) {
1684 v8::HandleScope scope; 1702 v8::HandleScope scope;
1685 ApiTestFuzzer::Fuzz(); 1703 ApiTestFuzzer::Fuzz();
1686 Local<v8::Array> result = v8::Array::New(args.Length()); 1704 Local<v8::Array> result = v8::Array::New(args.Length());
1687 for (int i = 0; i < args.Length(); i++) 1705 for (int i = 0; i < args.Length(); i++)
1688 result->Set(v8::Integer::New(i), args[i]); 1706 result->Set(i, args[i]);
1689 return scope.Close(result); 1707 return scope.Close(result);
1690 } 1708 }
1691 1709
1692 1710
1693 THREADED_TEST(Vector) { 1711 THREADED_TEST(Vector) {
1694 v8::HandleScope scope; 1712 v8::HandleScope scope;
1695 Local<ObjectTemplate> global = ObjectTemplate::New(); 1713 Local<ObjectTemplate> global = ObjectTemplate::New();
1696 global->Set(v8_str("f"), v8::FunctionTemplate::New(HandleF)); 1714 global->Set(v8_str("f"), v8::FunctionTemplate::New(HandleF));
1697 LocalContext context(0, global); 1715 LocalContext context(0, global);
1698 1716
1699 const char* fun = "f()"; 1717 const char* fun = "f()";
1700 Local<v8::Array> a0 = 1718 Local<v8::Array> a0 = CompileRun(fun).As<v8::Array>();
1701 Local<v8::Array>::Cast(Script::Compile(String::New(fun))->Run());
1702 CHECK_EQ(0, a0->Length()); 1719 CHECK_EQ(0, a0->Length());
1703 1720
1704 const char* fun2 = "f(11)"; 1721 const char* fun2 = "f(11)";
1705 Local<v8::Array> a1 = 1722 Local<v8::Array> a1 = CompileRun(fun2).As<v8::Array>();
1706 Local<v8::Array>::Cast(Script::Compile(String::New(fun2))->Run());
1707 CHECK_EQ(1, a1->Length()); 1723 CHECK_EQ(1, a1->Length());
1708 CHECK_EQ(11, a1->Get(v8::Integer::New(0))->Int32Value()); 1724 CHECK_EQ(11, a1->Get(0)->Int32Value());
1709 1725
1710 const char* fun3 = "f(12, 13)"; 1726 const char* fun3 = "f(12, 13)";
1711 Local<v8::Array> a2 = 1727 Local<v8::Array> a2 = CompileRun(fun3).As<v8::Array>();
1712 Local<v8::Array>::Cast(Script::Compile(String::New(fun3))->Run());
1713 CHECK_EQ(2, a2->Length()); 1728 CHECK_EQ(2, a2->Length());
1714 CHECK_EQ(12, a2->Get(v8::Integer::New(0))->Int32Value()); 1729 CHECK_EQ(12, a2->Get(0)->Int32Value());
1715 CHECK_EQ(13, a2->Get(v8::Integer::New(1))->Int32Value()); 1730 CHECK_EQ(13, a2->Get(1)->Int32Value());
1716 1731
1717 const char* fun4 = "f(14, 15, 16)"; 1732 const char* fun4 = "f(14, 15, 16)";
1718 Local<v8::Array> a3 = 1733 Local<v8::Array> a3 = CompileRun(fun4).As<v8::Array>();
1719 Local<v8::Array>::Cast(Script::Compile(String::New(fun4))->Run());
1720 CHECK_EQ(3, a3->Length()); 1734 CHECK_EQ(3, a3->Length());
1721 CHECK_EQ(14, a3->Get(v8::Integer::New(0))->Int32Value()); 1735 CHECK_EQ(14, a3->Get(0)->Int32Value());
1722 CHECK_EQ(15, a3->Get(v8::Integer::New(1))->Int32Value()); 1736 CHECK_EQ(15, a3->Get(1)->Int32Value());
1723 CHECK_EQ(16, a3->Get(v8::Integer::New(2))->Int32Value()); 1737 CHECK_EQ(16, a3->Get(2)->Int32Value());
1724 1738
1725 const char* fun5 = "f(17, 18, 19, 20)"; 1739 const char* fun5 = "f(17, 18, 19, 20)";
1726 Local<v8::Array> a4 = 1740 Local<v8::Array> a4 = CompileRun(fun5).As<v8::Array>();
1727 Local<v8::Array>::Cast(Script::Compile(String::New(fun5))->Run());
1728 CHECK_EQ(4, a4->Length()); 1741 CHECK_EQ(4, a4->Length());
1729 CHECK_EQ(17, a4->Get(v8::Integer::New(0))->Int32Value()); 1742 CHECK_EQ(17, a4->Get(0)->Int32Value());
1730 CHECK_EQ(18, a4->Get(v8::Integer::New(1))->Int32Value()); 1743 CHECK_EQ(18, a4->Get(1)->Int32Value());
1731 CHECK_EQ(19, a4->Get(v8::Integer::New(2))->Int32Value()); 1744 CHECK_EQ(19, a4->Get(2)->Int32Value());
1732 CHECK_EQ(20, a4->Get(v8::Integer::New(3))->Int32Value()); 1745 CHECK_EQ(20, a4->Get(3)->Int32Value());
1733 } 1746 }
1734 1747
1735 1748
1736 THREADED_TEST(FunctionCall) { 1749 THREADED_TEST(FunctionCall) {
1737 v8::HandleScope scope; 1750 v8::HandleScope scope;
1738 LocalContext context; 1751 LocalContext context;
1739 CompileRun( 1752 CompileRun(
1740 "function Foo() {" 1753 "function Foo() {"
1741 " var result = [];" 1754 " var result = [];"
1742 " for (var i = 0; i < arguments.length; i++) {" 1755 " for (var i = 0; i < arguments.length; i++) {"
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
2138 return v8::ThrowException(v8_str("FromC")); 2151 return v8::ThrowException(v8_str("FromC"));
2139 } else { 2152 } else {
2140 Local<v8::Object> global = Context::GetCurrent()->Global(); 2153 Local<v8::Object> global = Context::GetCurrent()->Global();
2141 Local<Value> fun = global->Get(v8_str("JSThrowCountDown")); 2154 Local<Value> fun = global->Get(v8_str("JSThrowCountDown"));
2142 v8::Handle<Value> argv[] = { v8_num(count - 1), 2155 v8::Handle<Value> argv[] = { v8_num(count - 1),
2143 args[1], 2156 args[1],
2144 args[2], 2157 args[2],
2145 args[3] }; 2158 args[3] };
2146 if (count % cInterval == 0) { 2159 if (count % cInterval == 0) {
2147 v8::TryCatch try_catch; 2160 v8::TryCatch try_catch;
2148 Local<Value> result = 2161 Local<Value> result = fun.As<Function>()->Call(global, 4, argv);
2149 v8::Handle<Function>::Cast(fun)->Call(global, 4, argv);
2150 int expected = args[3]->Int32Value(); 2162 int expected = args[3]->Int32Value();
2151 if (try_catch.HasCaught()) { 2163 if (try_catch.HasCaught()) {
2152 CHECK_EQ(expected, count); 2164 CHECK_EQ(expected, count);
2153 CHECK(result.IsEmpty()); 2165 CHECK(result.IsEmpty());
2154 CHECK(!i::Top::has_scheduled_exception()); 2166 CHECK(!i::Top::has_scheduled_exception());
2155 } else { 2167 } else {
2156 CHECK_NE(expected, count); 2168 CHECK_NE(expected, count);
2157 } 2169 }
2158 return result; 2170 return result;
2159 } else { 2171 } else {
2160 return v8::Handle<Function>::Cast(fun)->Call(global, 4, argv); 2172 return fun.As<Function>()->Call(global, 4, argv);
2161 } 2173 }
2162 } 2174 }
2163 } 2175 }
2164 2176
2165 2177
2166 v8::Handle<Value> JSCheck(const v8::Arguments& args) { 2178 v8::Handle<Value> JSCheck(const v8::Arguments& args) {
2167 ApiTestFuzzer::Fuzz(); 2179 ApiTestFuzzer::Fuzz();
2168 CHECK_EQ(3, args.Length()); 2180 CHECK_EQ(3, args.Length());
2169 bool equality = args[0]->BooleanValue(); 2181 bool equality = args[0]->BooleanValue();
2170 int count = args[1]->Int32Value(); 2182 int count = args[1]->Int32Value();
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
2540 Local<Value> result = script->Run(); 2552 Local<Value> result = script->Run();
2541 CHECK_EQ(result, v8_str("x")); 2553 CHECK_EQ(result, v8_str("x"));
2542 } 2554 }
2543 } 2555 }
2544 2556
2545 2557
2546 static v8::Handle<Value> SetXOnPrototypeGetter(Local<String> property, 2558 static v8::Handle<Value> SetXOnPrototypeGetter(Local<String> property,
2547 const AccessorInfo& info) { 2559 const AccessorInfo& info) {
2548 // Set x on the prototype object and do not handle the get request. 2560 // Set x on the prototype object and do not handle the get request.
2549 v8::Handle<v8::Value> proto = info.Holder()->GetPrototype(); 2561 v8::Handle<v8::Value> proto = info.Holder()->GetPrototype();
2550 v8::Handle<v8::Object>::Cast(proto)->Set(v8_str("x"), v8::Integer::New(23)); 2562 proto.As<v8::Object>()->Set(v8_str("x"), v8::Integer::New(23));
2551 return v8::Handle<Value>(); 2563 return v8::Handle<Value>();
2552 } 2564 }
2553 2565
2554 2566
2555 // This is a regression test for http://crbug.com/20104. Map 2567 // This is a regression test for http://crbug.com/20104. Map
2556 // transitions should not interfere with post interceptor lookup. 2568 // transitions should not interfere with post interceptor lookup.
2557 THREADED_TEST(NamedInterceptorMapTransitionRead) { 2569 THREADED_TEST(NamedInterceptorMapTransitionRead) {
2558 v8::HandleScope scope; 2570 v8::HandleScope scope;
2559 Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New(); 2571 Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New();
2560 Local<v8::ObjectTemplate> instance_template 2572 Local<v8::ObjectTemplate> instance_template
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
2876 THREADED_TEST(FunctionPrototypeAcrossContexts) { 2888 THREADED_TEST(FunctionPrototypeAcrossContexts) {
2877 // Make sure that functions created by cloning boilerplates cannot 2889 // Make sure that functions created by cloning boilerplates cannot
2878 // communicate through their __proto__ field. 2890 // communicate through their __proto__ field.
2879 2891
2880 v8::HandleScope scope; 2892 v8::HandleScope scope;
2881 2893
2882 LocalContext env0; 2894 LocalContext env0;
2883 v8::Handle<v8::Object> global0 = 2895 v8::Handle<v8::Object> global0 =
2884 env0->Global(); 2896 env0->Global();
2885 v8::Handle<v8::Object> object0 = 2897 v8::Handle<v8::Object> object0 =
2886 v8::Handle<v8::Object>::Cast(global0->Get(v8_str("Object"))); 2898 global0->Get(v8_str("Object")).As<v8::Object>();
2887 v8::Handle<v8::Object> tostring0 = 2899 v8::Handle<v8::Object> tostring0 =
2888 v8::Handle<v8::Object>::Cast(object0->Get(v8_str("toString"))); 2900 object0->Get(v8_str("toString")).As<v8::Object>();
2889 v8::Handle<v8::Object> proto0 = 2901 v8::Handle<v8::Object> proto0 =
2890 v8::Handle<v8::Object>::Cast(tostring0->Get(v8_str("__proto__"))); 2902 tostring0->Get(v8_str("__proto__")).As<v8::Object>();
2891 proto0->Set(v8_str("custom"), v8_num(1234)); 2903 proto0->Set(v8_str("custom"), v8_num(1234));
2892 2904
2893 LocalContext env1; 2905 LocalContext env1;
2894 v8::Handle<v8::Object> global1 = 2906 v8::Handle<v8::Object> global1 =
2895 env1->Global(); 2907 env1->Global();
2896 v8::Handle<v8::Object> object1 = 2908 v8::Handle<v8::Object> object1 =
2897 v8::Handle<v8::Object>::Cast(global1->Get(v8_str("Object"))); 2909 global1->Get(v8_str("Object")).As<v8::Object>();
2898 v8::Handle<v8::Object> tostring1 = 2910 v8::Handle<v8::Object> tostring1 =
2899 v8::Handle<v8::Object>::Cast(object1->Get(v8_str("toString"))); 2911 object1->Get(v8_str("toString")).As<v8::Object>();
2900 v8::Handle<v8::Object> proto1 = 2912 v8::Handle<v8::Object> proto1 =
2901 v8::Handle<v8::Object>::Cast(tostring1->Get(v8_str("__proto__"))); 2913 tostring1->Get(v8_str("__proto__")).As<v8::Object>();
2902 CHECK(!proto1->Has(v8_str("custom"))); 2914 CHECK(!proto1->Has(v8_str("custom")));
2903 } 2915 }
2904 2916
2905 2917
2906 THREADED_TEST(Regress892105) { 2918 THREADED_TEST(Regress892105) {
2907 // Make sure that object and array literals created by cloning 2919 // Make sure that object and array literals created by cloning
2908 // boilerplates cannot communicate through their __proto__ 2920 // boilerplates cannot communicate through their __proto__
2909 // field. This is rather difficult to check, but we try to add stuff 2921 // field. This is rather difficult to check, but we try to add stuff
2910 // to Object.prototype and Array.prototype and create a new 2922 // to Object.prototype and Array.prototype and create a new
2911 // environment. This should succeed. 2923 // environment. This should succeed.
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
3513 i::Heap::CollectAllGarbage(false); 3525 i::Heap::CollectAllGarbage(false);
3514 return v8::Undefined(); 3526 return v8::Undefined();
3515 } 3527 }
3516 3528
3517 3529
3518 THREADED_TEST(Arguments) { 3530 THREADED_TEST(Arguments) {
3519 v8::HandleScope scope; 3531 v8::HandleScope scope;
3520 v8::Handle<v8::ObjectTemplate> global = ObjectTemplate::New(); 3532 v8::Handle<v8::ObjectTemplate> global = ObjectTemplate::New();
3521 global->Set(v8_str("f"), v8::FunctionTemplate::New(ArgumentsTestCallback)); 3533 global->Set(v8_str("f"), v8::FunctionTemplate::New(ArgumentsTestCallback));
3522 LocalContext context(NULL, global); 3534 LocalContext context(NULL, global);
3523 args_fun = v8::Handle<Function>::Cast(context->Global()->Get(v8_str("f"))); 3535 args_fun = context->Global()->Get(v8_str("f")).As<Function>();
3524 v8_compile("f(1, 2, 3)")->Run(); 3536 v8_compile("f(1, 2, 3)")->Run();
3525 } 3537 }
3526 3538
3527 3539
3528 static v8::Handle<Value> NoBlockGetterX(Local<String> name, 3540 static v8::Handle<Value> NoBlockGetterX(Local<String> name,
3529 const AccessorInfo&) { 3541 const AccessorInfo&) {
3530 return v8::Handle<Value>(); 3542 return v8::Handle<Value>();
3531 } 3543 }
3532 3544
3533 3545
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
3851 3863
3852 3864
3853 THREADED_TEST(ErrorConstruction) { 3865 THREADED_TEST(ErrorConstruction) {
3854 v8::HandleScope scope; 3866 v8::HandleScope scope;
3855 LocalContext context; 3867 LocalContext context;
3856 3868
3857 v8::Handle<String> foo = v8_str("foo"); 3869 v8::Handle<String> foo = v8_str("foo");
3858 v8::Handle<String> message = v8_str("message"); 3870 v8::Handle<String> message = v8_str("message");
3859 v8::Handle<Value> range_error = v8::Exception::RangeError(foo); 3871 v8::Handle<Value> range_error = v8::Exception::RangeError(foo);
3860 CHECK(range_error->IsObject()); 3872 CHECK(range_error->IsObject());
3861 v8::Handle<v8::Object> range_obj(v8::Handle<v8::Object>::Cast(range_error)); 3873 v8::Handle<v8::Object> range_obj = range_error.As<v8::Object>();
3862 CHECK(v8::Handle<v8::Object>::Cast(range_error)->Get(message)->Equals(foo)); 3874 CHECK(range_error.As<v8::Object>()->Get(message)->Equals(foo));
3863 v8::Handle<Value> reference_error = v8::Exception::ReferenceError(foo); 3875 v8::Handle<Value> reference_error = v8::Exception::ReferenceError(foo);
3864 CHECK(reference_error->IsObject()); 3876 CHECK(reference_error->IsObject());
3865 CHECK( 3877 CHECK(reference_error.As<v8::Object>()->Get(message)->Equals(foo));
3866 v8::Handle<v8::Object>::Cast(reference_error)->Get(message)->Equals(foo));
3867 v8::Handle<Value> syntax_error = v8::Exception::SyntaxError(foo); 3878 v8::Handle<Value> syntax_error = v8::Exception::SyntaxError(foo);
3868 CHECK(syntax_error->IsObject()); 3879 CHECK(syntax_error->IsObject());
3869 CHECK(v8::Handle<v8::Object>::Cast(syntax_error)->Get(message)->Equals(foo)); 3880 CHECK(syntax_error.As<v8::Object>()->Get(message)->Equals(foo));
3870 v8::Handle<Value> type_error = v8::Exception::TypeError(foo); 3881 v8::Handle<Value> type_error = v8::Exception::TypeError(foo);
3871 CHECK(type_error->IsObject()); 3882 CHECK(type_error->IsObject());
3872 CHECK(v8::Handle<v8::Object>::Cast(type_error)->Get(message)->Equals(foo)); 3883 CHECK(type_error.As<v8::Object>()->Get(message)->Equals(foo));
3873 v8::Handle<Value> error = v8::Exception::Error(foo); 3884 v8::Handle<Value> error = v8::Exception::Error(foo);
3874 CHECK(error->IsObject()); 3885 CHECK(error->IsObject());
3875 CHECK(v8::Handle<v8::Object>::Cast(error)->Get(message)->Equals(foo)); 3886 CHECK(error.As<v8::Object>()->Get(message)->Equals(foo));
3876 } 3887 }
3877 3888
3878 3889
3879 static v8::Handle<Value> YGetter(Local<String> name, const AccessorInfo& info) { 3890 static v8::Handle<Value> YGetter(Local<String> name, const AccessorInfo& info) {
3880 ApiTestFuzzer::Fuzz(); 3891 ApiTestFuzzer::Fuzz();
3881 return v8_num(10); 3892 return v8_num(10);
3882 } 3893 }
3883 3894
3884 3895
3885 static void YSetter(Local<String> name, 3896 static void YSetter(Local<String> name,
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
4788 static bool NamedAccessFlatten(Local<v8::Object> global, 4799 static bool NamedAccessFlatten(Local<v8::Object> global,
4789 Local<Value> name, 4800 Local<Value> name,
4790 v8::AccessType type, 4801 v8::AccessType type,
4791 Local<Value> data) { 4802 Local<Value> data) {
4792 char buf[100]; 4803 char buf[100];
4793 int len; 4804 int len;
4794 4805
4795 CHECK(name->IsString()); 4806 CHECK(name->IsString());
4796 4807
4797 memset(buf, 0x1, sizeof(buf)); 4808 memset(buf, 0x1, sizeof(buf));
4798 len = Local<String>::Cast(name)->WriteAscii(buf); 4809 len = name.As<String>()->WriteAscii(buf);
4799 CHECK_EQ(4, len); 4810 CHECK_EQ(4, len);
4800 4811
4801 uint16_t buf2[100]; 4812 uint16_t buf2[100];
4802 4813
4803 memset(buf, 0x1, sizeof(buf)); 4814 memset(buf, 0x1, sizeof(buf));
4804 len = Local<String>::Cast(name)->Write(buf2); 4815 len = name.As<String>()->Write(buf2);
4805 CHECK_EQ(4, len); 4816 CHECK_EQ(4, len);
4806 4817
4807 return true; 4818 return true;
4808 } 4819 }
4809 4820
4810 4821
4811 static bool IndexedAccessFlatten(Local<v8::Object> global, 4822 static bool IndexedAccessFlatten(Local<v8::Object> global,
4812 uint32_t key, 4823 uint32_t key,
4813 v8::AccessType type, 4824 v8::AccessType type,
4814 Local<Value> data) { 4825 Local<Value> data) {
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
5143 CHECK_EQ(0, o0->Get(v8_str("x"))->Int32Value()); 5154 CHECK_EQ(0, o0->Get(v8_str("x"))->Int32Value());
5144 CHECK_EQ(1, o0->Get(v8_str("y"))->Int32Value()); 5155 CHECK_EQ(1, o0->Get(v8_str("y"))->Int32Value());
5145 CHECK_EQ(2, o0->Get(v8_str("z"))->Int32Value()); 5156 CHECK_EQ(2, o0->Get(v8_str("z"))->Int32Value());
5146 CHECK_EQ(3, o0->Get(v8_str("u"))->Int32Value()); 5157 CHECK_EQ(3, o0->Get(v8_str("u"))->Int32Value());
5147 5158
5148 // Getting the prototype of o0 should get the first visible one 5159 // Getting the prototype of o0 should get the first visible one
5149 // which is o3. Therefore, z should not be defined on the prototype 5160 // which is o3. Therefore, z should not be defined on the prototype
5150 // object. 5161 // object.
5151 Local<Value> proto = o0->Get(v8_str("__proto__")); 5162 Local<Value> proto = o0->Get(v8_str("__proto__"));
5152 CHECK(proto->IsObject()); 5163 CHECK(proto->IsObject());
5153 CHECK(Local<v8::Object>::Cast(proto)->Get(v8_str("z"))->IsUndefined()); 5164 CHECK(proto.As<v8::Object>()->Get(v8_str("z"))->IsUndefined());
5154 } 5165 }
5155 5166
5156 5167
5157 THREADED_TEST(SetPrototype) { 5168 THREADED_TEST(SetPrototype) {
5158 v8::HandleScope handle_scope; 5169 v8::HandleScope handle_scope;
5159 LocalContext context; 5170 LocalContext context;
5160 5171
5161 Local<v8::FunctionTemplate> t0 = v8::FunctionTemplate::New(); 5172 Local<v8::FunctionTemplate> t0 = v8::FunctionTemplate::New();
5162 t0->InstanceTemplate()->Set(v8_str("x"), v8_num(0)); 5173 t0->InstanceTemplate()->Set(v8_str("x"), v8_num(0));
5163 Local<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(); 5174 Local<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New();
(...skipping 23 matching lines...) Expand all
5187 CHECK_EQ(0, o0->Get(v8_str("x"))->Int32Value()); 5198 CHECK_EQ(0, o0->Get(v8_str("x"))->Int32Value());
5188 CHECK_EQ(1, o0->Get(v8_str("y"))->Int32Value()); 5199 CHECK_EQ(1, o0->Get(v8_str("y"))->Int32Value());
5189 CHECK_EQ(2, o0->Get(v8_str("z"))->Int32Value()); 5200 CHECK_EQ(2, o0->Get(v8_str("z"))->Int32Value());
5190 CHECK_EQ(3, o0->Get(v8_str("u"))->Int32Value()); 5201 CHECK_EQ(3, o0->Get(v8_str("u"))->Int32Value());
5191 5202
5192 // Getting the prototype of o0 should get the first visible one 5203 // Getting the prototype of o0 should get the first visible one
5193 // which is o3. Therefore, z should not be defined on the prototype 5204 // which is o3. Therefore, z should not be defined on the prototype
5194 // object. 5205 // object.
5195 Local<Value> proto = o0->Get(v8_str("__proto__")); 5206 Local<Value> proto = o0->Get(v8_str("__proto__"));
5196 CHECK(proto->IsObject()); 5207 CHECK(proto->IsObject());
5197 CHECK_EQ(v8::Handle<v8::Object>::Cast(proto), o3); 5208 CHECK_EQ(proto.As<v8::Object>(), o3);
5198 5209
5199 // However, Object::GetPrototype ignores hidden prototype. 5210 // However, Object::GetPrototype ignores hidden prototype.
5200 Local<Value> proto0 = o0->GetPrototype(); 5211 Local<Value> proto0 = o0->GetPrototype();
5201 CHECK(proto0->IsObject()); 5212 CHECK(proto0->IsObject());
5202 CHECK_EQ(v8::Handle<v8::Object>::Cast(proto0), o1); 5213 CHECK_EQ(proto0.As<v8::Object>(), o1);
5203 5214
5204 Local<Value> proto1 = o1->GetPrototype(); 5215 Local<Value> proto1 = o1->GetPrototype();
5205 CHECK(proto1->IsObject()); 5216 CHECK(proto1->IsObject());
5206 CHECK_EQ(v8::Handle<v8::Object>::Cast(proto1), o2); 5217 CHECK_EQ(proto1.As<v8::Object>(), o2);
5207 5218
5208 Local<Value> proto2 = o2->GetPrototype(); 5219 Local<Value> proto2 = o2->GetPrototype();
5209 CHECK(proto2->IsObject()); 5220 CHECK(proto2->IsObject());
5210 CHECK_EQ(v8::Handle<v8::Object>::Cast(proto2), o3); 5221 CHECK_EQ(proto2.As<v8::Object>(), o3);
5211 } 5222 }
5212 5223
5213 5224
5214 THREADED_TEST(SetPrototypeThrows) { 5225 THREADED_TEST(SetPrototypeThrows) {
5215 v8::HandleScope handle_scope; 5226 v8::HandleScope handle_scope;
5216 LocalContext context; 5227 LocalContext context;
5217 5228
5218 Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(); 5229 Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New();
5219 5230
5220 Local<v8::Object> o0 = t->GetFunction()->NewInstance(); 5231 Local<v8::Object> o0 = t->GetFunction()->NewInstance();
(...skipping 1691 matching lines...) Expand 10 before | Expand all | Expand 10 after
6912 // ObjectProtoToString should not call replace toString function. 6923 // ObjectProtoToString should not call replace toString function.
6913 value = instance->ObjectProtoToString(); 6924 value = instance->ObjectProtoToString();
6914 CHECK(value->IsString() && value->Equals(v8_str("[object MyClass]"))); 6925 CHECK(value->IsString() && value->Equals(v8_str("[object MyClass]")));
6915 6926
6916 // Check global 6927 // Check global
6917 value = context->Global()->ObjectProtoToString(); 6928 value = context->Global()->ObjectProtoToString();
6918 CHECK(value->IsString() && value->Equals(v8_str("[object global]"))); 6929 CHECK(value->IsString() && value->Equals(v8_str("[object global]")));
6919 6930
6920 // Check ordinary object 6931 // Check ordinary object
6921 Local<Value> object = v8_compile("new Object()")->Run(); 6932 Local<Value> object = v8_compile("new Object()")->Run();
6922 value = Local<v8::Object>::Cast(object)->ObjectProtoToString(); 6933 value = object.As<v8::Object>()->ObjectProtoToString();
6923 CHECK(value->IsString() && value->Equals(v8_str("[object Object]"))); 6934 CHECK(value->IsString() && value->Equals(v8_str("[object Object]")));
6924 } 6935 }
6925 6936
6926 6937
6927 bool ApiTestFuzzer::fuzzing_ = false; 6938 bool ApiTestFuzzer::fuzzing_ = false;
6928 v8::internal::Semaphore* ApiTestFuzzer::all_tests_done_= 6939 v8::internal::Semaphore* ApiTestFuzzer::all_tests_done_=
6929 v8::internal::OS::CreateSemaphore(0); 6940 v8::internal::OS::CreateSemaphore(0);
6930 int ApiTestFuzzer::active_tests_; 6941 int ApiTestFuzzer::active_tests_;
6931 int ApiTestFuzzer::tests_being_run_; 6942 int ApiTestFuzzer::tests_being_run_;
6932 int ApiTestFuzzer::current_; 6943 int ApiTestFuzzer::current_;
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
7532 v8::String::AsciiValue name(value); 7543 v8::String::AsciiValue name(value);
7533 CHECK_EQ("asdf", *name); 7544 CHECK_EQ("asdf", *name);
7534 } 7545 }
7535 7546
7536 7547
7537 THREADED_TEST(DateAccess) { 7548 THREADED_TEST(DateAccess) {
7538 v8::HandleScope scope; 7549 v8::HandleScope scope;
7539 LocalContext context; 7550 LocalContext context;
7540 v8::Handle<v8::Value> date = v8::Date::New(1224744689038.0); 7551 v8::Handle<v8::Value> date = v8::Date::New(1224744689038.0);
7541 CHECK(date->IsDate()); 7552 CHECK(date->IsDate());
7542 CHECK_EQ(1224744689038.0, v8::Handle<v8::Date>::Cast(date)->NumberValue()); 7553 CHECK_EQ(1224744689038.0, date.As<v8::Date>()->NumberValue());
7543 } 7554 }
7544 7555
7545 7556
7546 void CheckProperties(v8::Handle<v8::Value> val, int elmc, const char* elmv[]) { 7557 void CheckProperties(v8::Handle<v8::Value> val, int elmc, const char* elmv[]) {
7547 v8::Handle<v8::Object> obj = v8::Handle<v8::Object>::Cast(val); 7558 v8::Handle<v8::Object> obj = val.As<v8::Object>();
7548 v8::Handle<v8::Array> props = obj->GetPropertyNames(); 7559 v8::Handle<v8::Array> props = obj->GetPropertyNames();
7549 CHECK_EQ(elmc, props->Length()); 7560 CHECK_EQ(elmc, props->Length());
7550 for (int i = 0; i < elmc; i++) { 7561 for (int i = 0; i < elmc; i++) {
7551 v8::String::Utf8Value elm(props->Get(v8::Integer::New(i))); 7562 v8::String::Utf8Value elm(props->Get(v8::Integer::New(i)));
7552 CHECK_EQ(elmv[i], *elm); 7563 CHECK_EQ(elmv[i], *elm);
7553 } 7564 }
7554 } 7565 }
7555 7566
7556 7567
7557 THREADED_TEST(PropertyEnumeration) { 7568 THREADED_TEST(PropertyEnumeration) {
7558 v8::HandleScope scope; 7569 v8::HandleScope scope;
7559 LocalContext context; 7570 LocalContext context;
7560 v8::Handle<v8::Value> obj = v8::Script::Compile(v8::String::New( 7571 v8::Handle<v8::Value> obj = v8::Script::Compile(v8::String::New(
7561 "var result = [];" 7572 "var result = [];"
7562 "result[0] = {};" 7573 "result[0] = {};"
7563 "result[1] = {a: 1, b: 2};" 7574 "result[1] = {a: 1, b: 2};"
7564 "result[2] = [1, 2, 3];" 7575 "result[2] = [1, 2, 3];"
7565 "var proto = {x: 1, y: 2, z: 3};" 7576 "var proto = {x: 1, y: 2, z: 3};"
7566 "var x = { __proto__: proto, w: 0, z: 1 };" 7577 "var x = { __proto__: proto, w: 0, z: 1 };"
7567 "result[3] = x;" 7578 "result[3] = x;"
7568 "result;"))->Run(); 7579 "result;"))->Run();
7569 v8::Handle<v8::Array> elms = v8::Handle<v8::Array>::Cast(obj); 7580 v8::Handle<v8::Array> elms = obj.As<v8::Array>();
7570 CHECK_EQ(4, elms->Length()); 7581 CHECK_EQ(4, elms->Length());
7571 int elmc0 = 0; 7582 int elmc0 = 0;
7572 const char** elmv0 = NULL; 7583 const char** elmv0 = NULL;
7573 CheckProperties(elms->Get(v8::Integer::New(0)), elmc0, elmv0); 7584 CheckProperties(elms->Get(v8::Integer::New(0)), elmc0, elmv0);
7574 int elmc1 = 2; 7585 int elmc1 = 2;
7575 const char* elmv1[] = {"a", "b"}; 7586 const char* elmv1[] = {"a", "b"};
7576 CheckProperties(elms->Get(v8::Integer::New(1)), elmc1, elmv1); 7587 CheckProperties(elms->Get(v8::Integer::New(1)), elmc1, elmv1);
7577 int elmc2 = 3; 7588 int elmc2 = 3;
7578 const char* elmv2[] = {"0", "1", "2"}; 7589 const char* elmv2[] = {"0", "1", "2"};
7579 CheckProperties(elms->Get(v8::Integer::New(2)), elmc2, elmv2); 7590 CheckProperties(elms->Get(v8::Integer::New(2)), elmc2, elmv2);
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
8081 8092
8082 const char* sample = 8093 const char* sample =
8083 "var rv = {};" \ 8094 "var rv = {};" \
8084 "rv.alpha = 'hello';" \ 8095 "rv.alpha = 'hello';" \
8085 "rv.beta = 123;" \ 8096 "rv.beta = 123;" \
8086 "rv;"; 8097 "rv;";
8087 8098
8088 // Create an object, verify basics. 8099 // Create an object, verify basics.
8089 Local<Value> val = CompileRun(sample); 8100 Local<Value> val = CompileRun(sample);
8090 CHECK(val->IsObject()); 8101 CHECK(val->IsObject());
8091 Local<v8::Object> obj = Local<v8::Object>::Cast(val); 8102 Local<v8::Object> obj = val.As<v8::Object>();
8092 obj->Set(v8_str("gamma"), v8_str("cloneme")); 8103 obj->Set(v8_str("gamma"), v8_str("cloneme"));
8093 8104
8094 CHECK_EQ(v8_str("hello"), obj->Get(v8_str("alpha"))); 8105 CHECK_EQ(v8_str("hello"), obj->Get(v8_str("alpha")));
8095 CHECK_EQ(v8::Integer::New(123), obj->Get(v8_str("beta"))); 8106 CHECK_EQ(v8::Integer::New(123), obj->Get(v8_str("beta")));
8096 CHECK_EQ(v8_str("cloneme"), obj->Get(v8_str("gamma"))); 8107 CHECK_EQ(v8_str("cloneme"), obj->Get(v8_str("gamma")));
8097 8108
8098 // Clone it. 8109 // Clone it.
8099 Local<v8::Object> clone = obj->Clone(); 8110 Local<v8::Object> clone = obj->Clone();
8100 CHECK_EQ(v8_str("hello"), clone->Get(v8_str("alpha"))); 8111 CHECK_EQ(v8_str("hello"), clone->Get(v8_str("alpha")));
8101 CHECK_EQ(v8::Integer::New(123), clone->Get(v8_str("beta"))); 8112 CHECK_EQ(v8::Integer::New(123), clone->Get(v8_str("beta")));
(...skipping 1702 matching lines...) Expand 10 before | Expand all | Expand 10 after
9804 CHECK_EQ(42, c1->Get(v8_str("y"))->Int32Value()); 9815 CHECK_EQ(42, c1->Get(v8_str("y"))->Int32Value());
9805 } 9816 }
9806 9817
9807 script = v8::Script::Compile(v8_str("new C2();")); 9818 script = v8::Script::Compile(v8_str("new C2();"));
9808 for (int i = 0; i < 10; i++) { 9819 for (int i = 0; i < 10; i++) {
9809 v8::Handle<v8::Object> c2 = v8::Handle<v8::Object>::Cast(script->Run()); 9820 v8::Handle<v8::Object> c2 = v8::Handle<v8::Object>::Cast(script->Run());
9810 CHECK_EQ(23, c2->Get(v8_str("x"))->Int32Value()); 9821 CHECK_EQ(23, c2->Get(v8_str("x"))->Int32Value());
9811 CHECK_EQ(42, c2->Get(v8_str("y"))->Int32Value()); 9822 CHECK_EQ(42, c2->Get(v8_str("y"))->Int32Value());
9812 } 9823 }
9813 } 9824 }
OLDNEW
« src/runtime.cc ('K') | « src/runtime.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698