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

Side by Side Diff: src/runtime.cc

Issue 292433016: Revert "Reland r21346 "Inobject slack tracking is done on a per-closure basis instead of per-shared… (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 3106 matching lines...) Expand 10 before | Expand all | Expand 10 after
3117 return *target; 3117 return *target;
3118 } 3118 }
3119 3119
3120 3120
3121 RUNTIME_FUNCTION(Runtime_SetExpectedNumberOfProperties) { 3121 RUNTIME_FUNCTION(Runtime_SetExpectedNumberOfProperties) {
3122 HandleScope scope(isolate); 3122 HandleScope scope(isolate);
3123 ASSERT(args.length() == 2); 3123 ASSERT(args.length() == 2);
3124 CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0); 3124 CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0);
3125 CONVERT_SMI_ARG_CHECKED(num, 1); 3125 CONVERT_SMI_ARG_CHECKED(num, 1);
3126 RUNTIME_ASSERT(num >= 0); 3126 RUNTIME_ASSERT(num >= 0);
3127 3127 // If objects constructed from this function exist then changing
3128 func->shared()->set_expected_nof_properties(num); 3128 // 'estimated_nof_properties' is dangerous since the previous value might
3129 if (func->has_initial_map()) { 3129 // have been compiled into the fast construct stub. Moreover, the inobject
3130 Handle<Map> new_initial_map = Map::Copy(handle(func->initial_map())); 3130 // slack tracking logic might have adjusted the previous value, so even
3131 new_initial_map->set_unused_property_fields(num); 3131 // passing the same value is risky.
3132 func->set_initial_map(*new_initial_map); 3132 if (!func->shared()->live_objects_may_exist()) {
3133 func->shared()->set_expected_nof_properties(num);
3134 if (func->has_initial_map()) {
3135 Handle<Map> new_initial_map = Map::Copy(handle(func->initial_map()));
3136 new_initial_map->set_unused_property_fields(num);
3137 func->set_initial_map(*new_initial_map);
3138 }
3133 } 3139 }
3134 return isolate->heap()->undefined_value(); 3140 return isolate->heap()->undefined_value();
3135 } 3141 }
3136 3142
3137 3143
3138 RUNTIME_FUNCTION(RuntimeHidden_CreateJSGeneratorObject) { 3144 RUNTIME_FUNCTION(RuntimeHidden_CreateJSGeneratorObject) {
3139 HandleScope scope(isolate); 3145 HandleScope scope(isolate);
3140 ASSERT(args.length() == 0); 3146 ASSERT(args.length() == 0);
3141 3147
3142 JavaScriptFrameIterator it(isolate); 3148 JavaScriptFrameIterator it(isolate);
(...skipping 5216 matching lines...) Expand 10 before | Expand all | Expand 10 after
8359 // reported the same way whether or not 'Function' is called 8365 // reported the same way whether or not 'Function' is called
8360 // using 'new'. 8366 // using 'new'.
8361 return isolate->context()->global_object(); 8367 return isolate->context()->global_object();
8362 } 8368 }
8363 } 8369 }
8364 8370
8365 // The function should be compiled for the optimization hints to be 8371 // The function should be compiled for the optimization hints to be
8366 // available. 8372 // available.
8367 Compiler::EnsureCompiled(function, CLEAR_EXCEPTION); 8373 Compiler::EnsureCompiled(function, CLEAR_EXCEPTION);
8368 8374
8375 Handle<SharedFunctionInfo> shared(function->shared(), isolate);
8376 if (!function->has_initial_map() &&
8377 shared->IsInobjectSlackTrackingInProgress()) {
8378 // The tracking is already in progress for another function. We can only
8379 // track one initial_map at a time, so we force the completion before the
8380 // function is called as a constructor for the first time.
8381 shared->CompleteInobjectSlackTracking();
8382 }
8383
8369 Handle<JSObject> result; 8384 Handle<JSObject> result;
8370 if (site.is_null()) { 8385 if (site.is_null()) {
8371 result = isolate->factory()->NewJSObject(function); 8386 result = isolate->factory()->NewJSObject(function);
8372 } else { 8387 } else {
8373 result = isolate->factory()->NewJSObjectWithMemento(function, site); 8388 result = isolate->factory()->NewJSObjectWithMemento(function, site);
8374 } 8389 }
8375 8390
8376 isolate->counters()->constructed_objects()->Increment(); 8391 isolate->counters()->constructed_objects()->Increment();
8377 isolate->counters()->constructed_objects_runtime()->Increment(); 8392 isolate->counters()->constructed_objects_runtime()->Increment();
8378 8393
(...skipping 23 matching lines...) Expand all
8402 } 8417 }
8403 return Runtime_NewObjectHelper(isolate, constructor, site); 8418 return Runtime_NewObjectHelper(isolate, constructor, site);
8404 } 8419 }
8405 8420
8406 8421
8407 RUNTIME_FUNCTION(RuntimeHidden_FinalizeInstanceSize) { 8422 RUNTIME_FUNCTION(RuntimeHidden_FinalizeInstanceSize) {
8408 HandleScope scope(isolate); 8423 HandleScope scope(isolate);
8409 ASSERT(args.length() == 1); 8424 ASSERT(args.length() == 1);
8410 8425
8411 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); 8426 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
8412 function->CompleteInobjectSlackTracking(); 8427 function->shared()->CompleteInobjectSlackTracking();
8413 8428
8414 return isolate->heap()->undefined_value(); 8429 return isolate->heap()->undefined_value();
8415 } 8430 }
8416 8431
8417 8432
8418 RUNTIME_FUNCTION(RuntimeHidden_CompileUnoptimized) { 8433 RUNTIME_FUNCTION(RuntimeHidden_CompileUnoptimized) {
8419 HandleScope scope(isolate); 8434 HandleScope scope(isolate);
8420 ASSERT(args.length() == 1); 8435 ASSERT(args.length() == 1);
8421 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); 8436 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
8422 #ifdef DEBUG 8437 #ifdef DEBUG
(...skipping 6765 matching lines...) Expand 10 before | Expand all | Expand 10 after
15188 } 15203 }
15189 return NULL; 15204 return NULL;
15190 } 15205 }
15191 15206
15192 15207
15193 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 15208 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
15194 return &(kIntrinsicFunctions[static_cast<int>(id)]); 15209 return &(kIntrinsicFunctions[static_cast<int>(id)]);
15195 } 15210 }
15196 15211
15197 } } // namespace v8::internal 15212 } } // 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