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

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

Issue 1332003: Port number dictionary probing in generated code to ARM.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
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 | Annotate | Revision Log
« src/x64/ic-x64.cc ('K') | « src/x64/ic-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 2626 matching lines...) Expand 10 before | Expand all | Expand 10 after
2637 LocalContext context; 2637 LocalContext context;
2638 context->Global()->Set(v8_str("obj"), templ->NewInstance()); 2638 context->Global()->Set(v8_str("obj"), templ->NewInstance());
2639 Local<Script> script = Script::Compile(v8_str("obj.x")); 2639 Local<Script> script = Script::Compile(v8_str("obj.x"));
2640 for (int i = 0; i < 10; i++) { 2640 for (int i = 0; i < 10; i++) {
2641 Local<Value> result = script->Run(); 2641 Local<Value> result = script->Run();
2642 CHECK_EQ(result, v8_str("x")); 2642 CHECK_EQ(result, v8_str("x"));
2643 } 2643 }
2644 } 2644 }
2645 2645
2646 2646
2647 THREADED_TEST(NamedInterceptorDictionaryIC) {
2648 v8::HandleScope scope;
2649 Local<ObjectTemplate> templ = ObjectTemplate::New();
2650 templ->SetNamedPropertyHandler(XPropertyGetter);
2651 LocalContext context;
2652 // Create an object with a named interceptor.
2653 context->Global()->Set(v8_str("interceptor_obj"), templ->NewInstance());
2654 Local<Script> script = Script::Compile(v8_str("interceptor_obj.x"));
2655 for (int i = 0; i < 10; i++) {
2656 Local<Value> result = script->Run();
2657 CHECK_EQ(result, v8_str("x"));
2658 }
2659 // Create a slow case object and a function accessing a property in
2660 // that slow case object (with dictionary probing in generated
2661 // code). Then force object with a named interceptor into slow-case,
2662 // pass it to the function, and check that the interceptor is called
2663 // instead of accessing the local property.
2664 Local<Value> result =
2665 CompileRun("function get_x(o) { return o.x; };"
2666 "var obj = { x : 42, y : 0 };"
2667 "delete obj.y;"
2668 "for (var i = 0; i < 10; i++) get_x(obj);"
2669 "interceptor_obj.x = 42;"
2670 "interceptor_obj.y = 10;"
2671 "delete interceptor_obj.y;"
2672 "get_x(interceptor_obj)");
2673 CHECK_EQ(result, v8_str("x"));
2674 }
2675
2676
2647 static v8::Handle<Value> SetXOnPrototypeGetter(Local<String> property, 2677 static v8::Handle<Value> SetXOnPrototypeGetter(Local<String> property,
2648 const AccessorInfo& info) { 2678 const AccessorInfo& info) {
2649 // Set x on the prototype object and do not handle the get request. 2679 // Set x on the prototype object and do not handle the get request.
2650 v8::Handle<v8::Value> proto = info.Holder()->GetPrototype(); 2680 v8::Handle<v8::Value> proto = info.Holder()->GetPrototype();
2651 proto.As<v8::Object>()->Set(v8_str("x"), v8::Integer::New(23)); 2681 proto.As<v8::Object>()->Set(v8_str("x"), v8::Integer::New(23));
2652 return v8::Handle<Value>(); 2682 return v8::Handle<Value>();
2653 } 2683 }
2654 2684
2655 2685
2656 // This is a regression test for http://crbug.com/20104. Map 2686 // This is a regression test for http://crbug.com/20104. Map
(...skipping 7425 matching lines...) Expand 10 before | Expand all | Expand 10 after
10082 CHECK_EQ(2, prologue_call_count_second); 10112 CHECK_EQ(2, prologue_call_count_second);
10083 CHECK_EQ(2, epilogue_call_count_second); 10113 CHECK_EQ(2, epilogue_call_count_second);
10084 v8::V8::RemoveGCPrologueCallback(PrologueCallbackSecond); 10114 v8::V8::RemoveGCPrologueCallback(PrologueCallbackSecond);
10085 v8::V8::RemoveGCEpilogueCallback(EpilogueCallbackSecond); 10115 v8::V8::RemoveGCEpilogueCallback(EpilogueCallbackSecond);
10086 i::Heap::CollectAllGarbage(false); 10116 i::Heap::CollectAllGarbage(false);
10087 CHECK_EQ(2, prologue_call_count); 10117 CHECK_EQ(2, prologue_call_count);
10088 CHECK_EQ(2, epilogue_call_count); 10118 CHECK_EQ(2, epilogue_call_count);
10089 CHECK_EQ(2, prologue_call_count_second); 10119 CHECK_EQ(2, prologue_call_count_second);
10090 CHECK_EQ(2, epilogue_call_count_second); 10120 CHECK_EQ(2, epilogue_call_count_second);
10091 } 10121 }
OLDNEW
« src/x64/ic-x64.cc ('K') | « src/x64/ic-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698