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

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

Issue 647015: Remove the LookupResult IsValid method because it is confusing.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « src/x64/stub-cache-x64.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 2510 matching lines...) Expand 10 before | Expand all | Expand 10 after
2521 LocalContext context; 2521 LocalContext context;
2522 context->Global()->Set(v8_str("obj"), templ->NewInstance()); 2522 context->Global()->Set(v8_str("obj"), templ->NewInstance());
2523 Local<Script> script = Script::Compile(v8_str("obj.x")); 2523 Local<Script> script = Script::Compile(v8_str("obj.x"));
2524 for (int i = 0; i < 10; i++) { 2524 for (int i = 0; i < 10; i++) {
2525 Local<Value> result = script->Run(); 2525 Local<Value> result = script->Run();
2526 CHECK_EQ(result, v8_str("x")); 2526 CHECK_EQ(result, v8_str("x"));
2527 } 2527 }
2528 } 2528 }
2529 2529
2530 2530
2531 static v8::Handle<Value> SetXOnPrototypeGetter(Local<String> property,
2532 const AccessorInfo& info) {
2533 // Set x on the prototype object and do not handle the get request.
2534 v8::Handle<v8::Value> proto = info.Holder()->GetPrototype();
2535 v8::Handle<v8::Object>::Cast(proto)->Set(v8_str("x"), v8::Integer::New(23));
2536 return v8::Handle<Value>();
2537 }
2538
2539
2540 // This is a regression test for http://crbug.com/20104. Map
2541 // transitions should not interfere with post interceptor lookup.
2542 THREADED_TEST(NamedInterceptorMapTransitionRead) {
2543 v8::HandleScope scope;
2544 Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New();
2545 Local<v8::ObjectTemplate> instance_template
2546 = function_template->InstanceTemplate();
2547 instance_template->SetNamedPropertyHandler(SetXOnPrototypeGetter);
2548 LocalContext context;
2549 context->Global()->Set(v8_str("F"), function_template->GetFunction());
2550 // Create an instance of F and introduce a map transition for x.
2551 CompileRun("var o = new F(); o.x = 23;");
2552 // Create an instance of F and invoke the getter. The result should be 23.
2553 Local<Value> result = CompileRun("o = new F(); o.x");
2554 CHECK_EQ(result->Int32Value(), 23);
2555 }
2556
2557
2531 static v8::Handle<Value> IndexedPropertyGetter(uint32_t index, 2558 static v8::Handle<Value> IndexedPropertyGetter(uint32_t index,
2532 const AccessorInfo& info) { 2559 const AccessorInfo& info) {
2533 ApiTestFuzzer::Fuzz(); 2560 ApiTestFuzzer::Fuzz();
2534 if (index == 37) { 2561 if (index == 37) {
2535 return v8::Handle<Value>(v8_num(625)); 2562 return v8::Handle<Value>(v8_num(625));
2536 } 2563 }
2537 return v8::Handle<Value>(); 2564 return v8::Handle<Value>();
2538 } 2565 }
2539 2566
2540 2567
(...skipping 7148 matching lines...) Expand 10 before | Expand all | Expand 10 after
9689 CHECK_EQ(42, c1->Get(v8_str("y"))->Int32Value()); 9716 CHECK_EQ(42, c1->Get(v8_str("y"))->Int32Value());
9690 } 9717 }
9691 9718
9692 script = v8::Script::Compile(v8_str("new C2();")); 9719 script = v8::Script::Compile(v8_str("new C2();"));
9693 for (int i = 0; i < 10; i++) { 9720 for (int i = 0; i < 10; i++) {
9694 v8::Handle<v8::Object> c2 = v8::Handle<v8::Object>::Cast(script->Run()); 9721 v8::Handle<v8::Object> c2 = v8::Handle<v8::Object>::Cast(script->Run());
9695 CHECK_EQ(23, c2->Get(v8_str("x"))->Int32Value()); 9722 CHECK_EQ(23, c2->Get(v8_str("x"))->Int32Value());
9696 CHECK_EQ(42, c2->Get(v8_str("y"))->Int32Value()); 9723 CHECK_EQ(42, c2->Get(v8_str("y"))->Int32Value());
9697 } 9724 }
9698 } 9725 }
OLDNEW
« no previous file with comments | « src/x64/stub-cache-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698