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

Side by Side Diff: src/runtime.cc

Issue 290993009: Reland r21346 "Inobject slack tracking is done on a per-closure basis instead of per-shared info ba… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: The fix Created 6 years, 7 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/objects-inl.h ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdlib.h> 5 #include <stdlib.h>
6 #include <limits> 6 #include <limits>
7 7
8 #include "v8.h" 8 #include "v8.h"
9 9
10 #include "accessors.h" 10 #include "accessors.h"
(...skipping 3107 matching lines...) Expand 10 before | Expand all | Expand 10 after
3118 return *target; 3118 return *target;
3119 } 3119 }
3120 3120
3121 3121
3122 RUNTIME_FUNCTION(Runtime_SetExpectedNumberOfProperties) { 3122 RUNTIME_FUNCTION(Runtime_SetExpectedNumberOfProperties) {
3123 HandleScope scope(isolate); 3123 HandleScope scope(isolate);
3124 ASSERT(args.length() == 2); 3124 ASSERT(args.length() == 2);
3125 CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0); 3125 CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0);
3126 CONVERT_SMI_ARG_CHECKED(num, 1); 3126 CONVERT_SMI_ARG_CHECKED(num, 1);
3127 RUNTIME_ASSERT(num >= 0); 3127 RUNTIME_ASSERT(num >= 0);
3128 // If objects constructed from this function exist then changing 3128
3129 // 'estimated_nof_properties' is dangerous since the previous value might 3129 func->shared()->set_expected_nof_properties(num);
3130 // have been compiled into the fast construct stub. Moreover, the inobject 3130 if (func->has_initial_map()) {
3131 // slack tracking logic might have adjusted the previous value, so even 3131 Handle<Map> new_initial_map = Map::Copy(handle(func->initial_map()));
3132 // passing the same value is risky. 3132 new_initial_map->set_unused_property_fields(num);
3133 if (!func->shared()->live_objects_may_exist()) { 3133 func->set_initial_map(*new_initial_map);
3134 func->shared()->set_expected_nof_properties(num);
3135 if (func->has_initial_map()) {
3136 Handle<Map> new_initial_map = Map::Copy(handle(func->initial_map()));
3137 new_initial_map->set_unused_property_fields(num);
3138 func->set_initial_map(*new_initial_map);
3139 }
3140 } 3134 }
3141 return isolate->heap()->undefined_value(); 3135 return isolate->heap()->undefined_value();
3142 } 3136 }
3143 3137
3144 3138
3145 RUNTIME_FUNCTION(RuntimeHidden_CreateJSGeneratorObject) { 3139 RUNTIME_FUNCTION(RuntimeHidden_CreateJSGeneratorObject) {
3146 HandleScope scope(isolate); 3140 HandleScope scope(isolate);
3147 ASSERT(args.length() == 0); 3141 ASSERT(args.length() == 0);
3148 3142
3149 JavaScriptFrameIterator it(isolate); 3143 JavaScriptFrameIterator it(isolate);
(...skipping 5216 matching lines...) Expand 10 before | Expand all | Expand 10 after
8366 // reported the same way whether or not 'Function' is called 8360 // reported the same way whether or not 'Function' is called
8367 // using 'new'. 8361 // using 'new'.
8368 return isolate->context()->global_object(); 8362 return isolate->context()->global_object();
8369 } 8363 }
8370 } 8364 }
8371 8365
8372 // The function should be compiled for the optimization hints to be 8366 // The function should be compiled for the optimization hints to be
8373 // available. 8367 // available.
8374 Compiler::EnsureCompiled(function, CLEAR_EXCEPTION); 8368 Compiler::EnsureCompiled(function, CLEAR_EXCEPTION);
8375 8369
8376 Handle<SharedFunctionInfo> shared(function->shared(), isolate);
8377 if (!function->has_initial_map() &&
8378 shared->IsInobjectSlackTrackingInProgress()) {
8379 // The tracking is already in progress for another function. We can only
8380 // track one initial_map at a time, so we force the completion before the
8381 // function is called as a constructor for the first time.
8382 shared->CompleteInobjectSlackTracking();
8383 }
8384
8385 Handle<JSObject> result; 8370 Handle<JSObject> result;
8386 if (site.is_null()) { 8371 if (site.is_null()) {
8387 result = isolate->factory()->NewJSObject(function); 8372 result = isolate->factory()->NewJSObject(function);
8388 } else { 8373 } else {
8389 result = isolate->factory()->NewJSObjectWithMemento(function, site); 8374 result = isolate->factory()->NewJSObjectWithMemento(function, site);
8390 } 8375 }
8391 8376
8392 isolate->counters()->constructed_objects()->Increment(); 8377 isolate->counters()->constructed_objects()->Increment();
8393 isolate->counters()->constructed_objects_runtime()->Increment(); 8378 isolate->counters()->constructed_objects_runtime()->Increment();
8394 8379
(...skipping 23 matching lines...) Expand all
8418 } 8403 }
8419 return Runtime_NewObjectHelper(isolate, constructor, site); 8404 return Runtime_NewObjectHelper(isolate, constructor, site);
8420 } 8405 }
8421 8406
8422 8407
8423 RUNTIME_FUNCTION(RuntimeHidden_FinalizeInstanceSize) { 8408 RUNTIME_FUNCTION(RuntimeHidden_FinalizeInstanceSize) {
8424 HandleScope scope(isolate); 8409 HandleScope scope(isolate);
8425 ASSERT(args.length() == 1); 8410 ASSERT(args.length() == 1);
8426 8411
8427 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); 8412 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
8428 function->shared()->CompleteInobjectSlackTracking(); 8413 function->CompleteInobjectSlackTracking();
8429 8414
8430 return isolate->heap()->undefined_value(); 8415 return isolate->heap()->undefined_value();
8431 } 8416 }
8432 8417
8433 8418
8434 RUNTIME_FUNCTION(RuntimeHidden_CompileUnoptimized) { 8419 RUNTIME_FUNCTION(RuntimeHidden_CompileUnoptimized) {
8435 HandleScope scope(isolate); 8420 HandleScope scope(isolate);
8436 ASSERT(args.length() == 1); 8421 ASSERT(args.length() == 1);
8437 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); 8422 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
8438 #ifdef DEBUG 8423 #ifdef DEBUG
(...skipping 6766 matching lines...) Expand 10 before | Expand all | Expand 10 after
15205 } 15190 }
15206 return NULL; 15191 return NULL;
15207 } 15192 }
15208 15193
15209 15194
15210 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 15195 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
15211 return &(kIntrinsicFunctions[static_cast<int>(id)]); 15196 return &(kIntrinsicFunctions[static_cast<int>(id)]);
15212 } 15197 }
15213 15198
15214 } } // namespace v8::internal 15199 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698