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

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

Issue 5107002: Avoiding repacking payload for v8::Arguments and v8::AccessorInfo (arm). (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 1 month 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/builtins.cc ('K') | « 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 6306 matching lines...) Expand 10 before | Expand all | Expand 10 after
6317 6317
6318 typedef v8::Handle<Value> (*NamedPropertyGetter)(Local<String> property, 6318 typedef v8::Handle<Value> (*NamedPropertyGetter)(Local<String> property,
6319 const AccessorInfo& info); 6319 const AccessorInfo& info);
6320 6320
6321 6321
6322 static void CheckInterceptorLoadIC(NamedPropertyGetter getter, 6322 static void CheckInterceptorLoadIC(NamedPropertyGetter getter,
6323 const char* source, 6323 const char* source,
6324 int expected) { 6324 int expected) {
6325 v8::HandleScope scope; 6325 v8::HandleScope scope;
6326 v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(); 6326 v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New();
6327 templ->SetNamedPropertyHandler(getter); 6327 templ->SetNamedPropertyHandler(getter, 0, 0, 0, 0, v8_str("data"));
6328 LocalContext context; 6328 LocalContext context;
6329 context->Global()->Set(v8_str("o"), templ->NewInstance()); 6329 context->Global()->Set(v8_str("o"), templ->NewInstance());
6330 v8::Handle<Value> value = CompileRun(source); 6330 v8::Handle<Value> value = CompileRun(source);
6331 CHECK_EQ(expected, value->Int32Value()); 6331 CHECK_EQ(expected, value->Int32Value());
6332 } 6332 }
6333 6333
6334 6334
6335 static v8::Handle<Value> InterceptorLoadICGetter(Local<String> name, 6335 static v8::Handle<Value> InterceptorLoadICGetter(Local<String> name,
6336 const AccessorInfo& info) { 6336 const AccessorInfo& info) {
6337 ApiTestFuzzer::Fuzz(); 6337 ApiTestFuzzer::Fuzz();
6338 CHECK(v8_str("x")->Equals(name)); 6338 CHECK_EQ(v8_str("data"), info.Data());
6339 CHECK_EQ(v8_str("x"), name);
6339 return v8::Integer::New(42); 6340 return v8::Integer::New(42);
6340 } 6341 }
6341 6342
6342 6343
6343 // This test should hit the load IC for the interceptor case. 6344 // This test should hit the load IC for the interceptor case.
6344 THREADED_TEST(InterceptorLoadIC) { 6345 THREADED_TEST(InterceptorLoadIC) {
6345 CheckInterceptorLoadIC(InterceptorLoadICGetter, 6346 CheckInterceptorLoadIC(InterceptorLoadICGetter,
6346 "var result = 0;" 6347 "var result = 0;"
6347 "for (var i = 0; i < 1000; i++) {" 6348 "for (var i = 0; i < 1000; i++) {"
6348 " result = o.x;" 6349 " result = o.x;"
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
6726 CHECK_EQ(42, value->Int32Value()); 6727 CHECK_EQ(42, value->Int32Value());
6727 return value; 6728 return value;
6728 } 6729 }
6729 6730
6730 6731
6731 // This test should hit the store IC for the interceptor case. 6732 // This test should hit the store IC for the interceptor case.
6732 THREADED_TEST(InterceptorStoreIC) { 6733 THREADED_TEST(InterceptorStoreIC) {
6733 v8::HandleScope scope; 6734 v8::HandleScope scope;
6734 v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(); 6735 v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New();
6735 templ->SetNamedPropertyHandler(InterceptorLoadICGetter, 6736 templ->SetNamedPropertyHandler(InterceptorLoadICGetter,
6736 InterceptorStoreICSetter); 6737 InterceptorStoreICSetter,
6738 0, 0, 0, v8_str("data"));
6737 LocalContext context; 6739 LocalContext context;
6738 context->Global()->Set(v8_str("o"), templ->NewInstance()); 6740 context->Global()->Set(v8_str("o"), templ->NewInstance());
6739 v8::Handle<Value> value = CompileRun( 6741 v8::Handle<Value> value = CompileRun(
6740 "for (var i = 0; i < 1000; i++) {" 6742 "for (var i = 0; i < 1000; i++) {"
6741 " o.x = 42;" 6743 " o.x = 42;"
6742 "}"); 6744 "}");
6743 } 6745 }
6744 6746
6745 6747
6746 THREADED_TEST(InterceptorStoreICWithNoSetter) { 6748 THREADED_TEST(InterceptorStoreICWithNoSetter) {
(...skipping 5018 matching lines...) Expand 10 before | Expand all | Expand 10 after
11765 v8::Context::Scope context_scope(context.local()); 11767 v8::Context::Scope context_scope(context.local());
11766 11768
11767 v8::Handle<v8::ObjectTemplate> tmpl = v8::ObjectTemplate::New(); 11769 v8::Handle<v8::ObjectTemplate> tmpl = v8::ObjectTemplate::New();
11768 tmpl->SetNamedPropertyHandler(Getter, NULL, NULL, NULL, Enumerator); 11770 tmpl->SetNamedPropertyHandler(Getter, NULL, NULL, NULL, Enumerator);
11769 context->Global()->Set(v8_str("o"), tmpl->NewInstance()); 11771 context->Global()->Set(v8_str("o"), tmpl->NewInstance());
11770 v8::Handle<v8::Array> result = v8::Handle<v8::Array>::Cast(CompileRun( 11772 v8::Handle<v8::Array> result = v8::Handle<v8::Array>::Cast(CompileRun(
11771 "var result = []; for (var k in o) result.push(k); result")); 11773 "var result = []; for (var k in o) result.push(k); result"));
11772 CHECK_EQ(1, result->Length()); 11774 CHECK_EQ(1, result->Length());
11773 CHECK_EQ(v8_str("universalAnswer"), result->Get(0)); 11775 CHECK_EQ(v8_str("universalAnswer"), result->Get(0));
11774 } 11776 }
OLDNEW
« src/builtins.cc ('K') | « src/x64/stub-cache-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698