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

Side by Side Diff: src/compiler/js-create-lowering.cc

Issue 1708313002: [stubs] Introduce a dedicated FastNewObjectStub. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove TODO. Created 4 years, 10 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
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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 "src/compiler/js-create-lowering.h" 5 #include "src/compiler/js-create-lowering.h"
6 6
7 #include "src/allocation-site-scopes.h" 7 #include "src/allocation-site-scopes.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/compilation-dependencies.h" 9 #include "src/compilation-dependencies.h"
10 #include "src/compiler/access-builder.h" 10 #include "src/compiler/access-builder.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 // Extract constructor function. 236 // Extract constructor function.
237 if (target_type->IsConstant() && 237 if (target_type->IsConstant() &&
238 target_type->AsConstant()->Value()->IsJSFunction()) { 238 target_type->AsConstant()->Value()->IsJSFunction()) {
239 Handle<JSFunction> constructor = 239 Handle<JSFunction> constructor =
240 Handle<JSFunction>::cast(target_type->AsConstant()->Value()); 240 Handle<JSFunction>::cast(target_type->AsConstant()->Value());
241 DCHECK(constructor->IsConstructor()); 241 DCHECK(constructor->IsConstructor());
242 // Force completion of inobject slack tracking before 242 // Force completion of inobject slack tracking before
243 // generating code to finalize the instance size. 243 // generating code to finalize the instance size.
244 constructor->CompleteInobjectSlackTrackingIfActive(); 244 constructor->CompleteInobjectSlackTrackingIfActive();
245 245
246 // TODO(bmeurer): We fall back to the runtime in case we cannot inline 246 // Check if we can inline the allocation.
247 // the allocation here, which is sort of expensive. We should think about
248 // a soft fallback to some NewObjectCodeStub.
249 if (IsAllocationInlineable(constructor)) { 247 if (IsAllocationInlineable(constructor)) {
250 // Compute instance size from initial map of {constructor}. 248 // Compute instance size from initial map of {constructor}.
251 Handle<Map> initial_map(constructor->initial_map(), isolate()); 249 Handle<Map> initial_map(constructor->initial_map(), isolate());
252 int const instance_size = initial_map->instance_size(); 250 int const instance_size = initial_map->instance_size();
253 251
254 // Add a dependency on the {initial_map} to make sure that this code is 252 // Add a dependency on the {initial_map} to make sure that this code is
255 // deoptimized whenever the {initial_map} of the {constructor} changes. 253 // deoptimized whenever the {initial_map} of the {constructor} changes.
256 dependencies()->AssumeInitialMapCantChange(initial_map); 254 dependencies()->AssumeInitialMapCantChange(initial_map);
257 255
258 // Emit code to allocate the JSObject instance for the {constructor}. 256 // Emit code to allocate the JSObject instance for the {constructor}.
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 return jsgraph()->simplified(); 1086 return jsgraph()->simplified();
1089 } 1087 }
1090 1088
1091 MachineOperatorBuilder* JSCreateLowering::machine() const { 1089 MachineOperatorBuilder* JSCreateLowering::machine() const {
1092 return jsgraph()->machine(); 1090 return jsgraph()->machine();
1093 } 1091 }
1094 1092
1095 } // namespace compiler 1093 } // namespace compiler
1096 } // namespace internal 1094 } // namespace internal
1097 } // namespace v8 1095 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698