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

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

Issue 3329019: Dynamically determine optimal instance size.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 3 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/runtime.cc ('K') | « src/x64/builtins-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 10929 matching lines...) Expand 10 before | Expand all | Expand 10 after
10940 10940
10941 // Use a simple object as prototype. 10941 // Use a simple object as prototype.
10942 v8::Local<v8::Object> prototype = v8::Object::New(); 10942 v8::Local<v8::Object> prototype = v8::Object::New();
10943 prototype->Set(v8_str("y"), v8_num(42)); 10943 prototype->Set(v8_str("y"), v8_num(42));
10944 context->Global()->Set(v8_str("P"), prototype); 10944 context->Global()->Set(v8_str("P"), prototype);
10945 10945
10946 // This compile will add the code to the compilation cache. 10946 // This compile will add the code to the compilation cache.
10947 CompileRun(source); 10947 CompileRun(source);
10948 10948
10949 script = v8::Script::Compile(v8_str("new C1();")); 10949 script = v8::Script::Compile(v8_str("new C1();"));
10950 for (int i = 0; i < 10; i++) { 10950 // Allow enough iterations for the inobject slack tracking logic
10951 // to finalize instance size and install the fast construct stub.
10952 for (int i = 0; i < 256; i++) {
10951 v8::Handle<v8::Object> c1 = v8::Handle<v8::Object>::Cast(script->Run()); 10953 v8::Handle<v8::Object> c1 = v8::Handle<v8::Object>::Cast(script->Run());
10952 CHECK_EQ(23, c1->Get(v8_str("x"))->Int32Value()); 10954 CHECK_EQ(23, c1->Get(v8_str("x"))->Int32Value());
10953 CHECK_EQ(42, c1->Get(v8_str("y"))->Int32Value()); 10955 CHECK_EQ(42, c1->Get(v8_str("y"))->Int32Value());
10954 } 10956 }
10955 10957
10956 // Use an API object with accessors as prototype. 10958 // Use an API object with accessors as prototype.
10957 Local<ObjectTemplate> templ = ObjectTemplate::New(); 10959 Local<ObjectTemplate> templ = ObjectTemplate::New();
10958 templ->SetAccessor(v8_str("x"), 10960 templ->SetAccessor(v8_str("x"),
10959 GetterWhichReturns42, 10961 GetterWhichReturns42,
10960 SetterWhichSetsYOnThisTo23); 10962 SetterWhichSetsYOnThisTo23);
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
11370 11372
11371 { 11373 {
11372 // Change the Boolean.prototype in the second context and check 11374 // Change the Boolean.prototype in the second context and check
11373 // that the right function gets called. 11375 // that the right function gets called.
11374 v8::HandleScope scope; 11376 v8::HandleScope scope;
11375 LocalContext context2; 11377 LocalContext context2;
11376 CompileRun("Boolean.prototype.toString = function() { return \"\"; }"); 11378 CompileRun("Boolean.prototype.toString = function() { return \"\"; }");
11377 ExpectString(code, ""); 11379 ExpectString(code, "");
11378 } 11380 }
11379 } 11381 }
OLDNEW
« src/runtime.cc ('K') | « src/x64/builtins-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698