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

Side by Side Diff: src/runtime.cc

Issue 295933012: Revert "Inobject slack tracking is done on a per-closure basis instead of per-shared info basis." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 3128 // If objects constructed from this function exist then changing
3129 func->shared()->set_expected_nof_properties(num); 3129 // 'estimated_nof_properties' is dangerous since the previous value might
3130 if (func->has_initial_map()) { 3130 // have been compiled into the fast construct stub. Moreover, the inobject
3131 Handle<Map> new_initial_map = Map::Copy(handle(func->initial_map())); 3131 // slack tracking logic might have adjusted the previous value, so even
3132 new_initial_map->set_unused_property_fields(num); 3132 // passing the same value is risky.
3133 func->set_initial_map(*new_initial_map); 3133 if (!func->shared()->live_objects_may_exist()) {
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 }
3134 } 3140 }
3135 return isolate->heap()->undefined_value(); 3141 return isolate->heap()->undefined_value();
3136 } 3142 }
3137 3143
3138 3144
3139 RUNTIME_FUNCTION(RuntimeHidden_CreateJSGeneratorObject) { 3145 RUNTIME_FUNCTION(RuntimeHidden_CreateJSGeneratorObject) {
3140 HandleScope scope(isolate); 3146 HandleScope scope(isolate);
3141 ASSERT(args.length() == 0); 3147 ASSERT(args.length() == 0);
3142 3148
3143 JavaScriptFrameIterator it(isolate); 3149 JavaScriptFrameIterator it(isolate);
(...skipping 5216 matching lines...) Expand 10 before | Expand all | Expand 10 after
8360 // reported the same way whether or not 'Function' is called 8366 // reported the same way whether or not 'Function' is called
8361 // using 'new'. 8367 // using 'new'.
8362 return isolate->context()->global_object(); 8368 return isolate->context()->global_object();
8363 } 8369 }
8364 } 8370 }
8365 8371
8366 // The function should be compiled for the optimization hints to be 8372 // The function should be compiled for the optimization hints to be
8367 // available. 8373 // available.
8368 Compiler::EnsureCompiled(function, CLEAR_EXCEPTION); 8374 Compiler::EnsureCompiled(function, CLEAR_EXCEPTION);
8369 8375
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
8370 Handle<JSObject> result; 8385 Handle<JSObject> result;
8371 if (site.is_null()) { 8386 if (site.is_null()) {
8372 result = isolate->factory()->NewJSObject(function); 8387 result = isolate->factory()->NewJSObject(function);
8373 } else { 8388 } else {
8374 result = isolate->factory()->NewJSObjectWithMemento(function, site); 8389 result = isolate->factory()->NewJSObjectWithMemento(function, site);
8375 } 8390 }
8376 8391
8377 isolate->counters()->constructed_objects()->Increment(); 8392 isolate->counters()->constructed_objects()->Increment();
8378 isolate->counters()->constructed_objects_runtime()->Increment(); 8393 isolate->counters()->constructed_objects_runtime()->Increment();
8379 8394
(...skipping 23 matching lines...) Expand all
8403 } 8418 }
8404 return Runtime_NewObjectHelper(isolate, constructor, site); 8419 return Runtime_NewObjectHelper(isolate, constructor, site);
8405 } 8420 }
8406 8421
8407 8422
8408 RUNTIME_FUNCTION(RuntimeHidden_FinalizeInstanceSize) { 8423 RUNTIME_FUNCTION(RuntimeHidden_FinalizeInstanceSize) {
8409 HandleScope scope(isolate); 8424 HandleScope scope(isolate);
8410 ASSERT(args.length() == 1); 8425 ASSERT(args.length() == 1);
8411 8426
8412 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); 8427 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
8413 function->CompleteInobjectSlackTracking(); 8428 function->shared()->CompleteInobjectSlackTracking();
8414 8429
8415 return isolate->heap()->undefined_value(); 8430 return isolate->heap()->undefined_value();
8416 } 8431 }
8417 8432
8418 8433
8419 RUNTIME_FUNCTION(RuntimeHidden_CompileUnoptimized) { 8434 RUNTIME_FUNCTION(RuntimeHidden_CompileUnoptimized) {
8420 HandleScope scope(isolate); 8435 HandleScope scope(isolate);
8421 ASSERT(args.length() == 1); 8436 ASSERT(args.length() == 1);
8422 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); 8437 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
8423 #ifdef DEBUG 8438 #ifdef DEBUG
(...skipping 6766 matching lines...) Expand 10 before | Expand all | Expand 10 after
15190 } 15205 }
15191 return NULL; 15206 return NULL;
15192 } 15207 }
15193 15208
15194 15209
15195 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 15210 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
15196 return &(kIntrinsicFunctions[static_cast<int>(id)]); 15211 return &(kIntrinsicFunctions[static_cast<int>(id)]);
15197 } 15212 }
15198 15213
15199 } } // namespace v8::internal 15214 } } // 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