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

Side by Side Diff: src/compiler/js-inlining.cc

Issue 2703133003: [turbofan] Unify NodeProperties::InferReceiverMaps. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « src/compiler/js-call-reducer.cc ('k') | src/compiler/js-native-context-specialization.h » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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-inlining.h" 5 #include "src/compiler/js-inlining.h"
6 6
7 #include "src/ast/ast.h" 7 #include "src/ast/ast.h"
8 #include "src/compilation-info.h" 8 #include "src/compilation-info.h"
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/compiler/all-nodes.h" 10 #include "src/compiler/all-nodes.h"
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 case IrOpcode::kJSCreateArguments: 298 case IrOpcode::kJSCreateArguments:
299 case IrOpcode::kJSCreateArray: 299 case IrOpcode::kJSCreateArray:
300 case IrOpcode::kJSCreateClosure: 300 case IrOpcode::kJSCreateClosure:
301 case IrOpcode::kJSCreateIterResultObject: 301 case IrOpcode::kJSCreateIterResultObject:
302 case IrOpcode::kJSCreateKeyValueArray: 302 case IrOpcode::kJSCreateKeyValueArray:
303 case IrOpcode::kJSCreateLiteralArray: 303 case IrOpcode::kJSCreateLiteralArray:
304 case IrOpcode::kJSCreateLiteralObject: 304 case IrOpcode::kJSCreateLiteralObject:
305 case IrOpcode::kJSCreateLiteralRegExp: 305 case IrOpcode::kJSCreateLiteralRegExp:
306 case IrOpcode::kJSConvertReceiver: 306 case IrOpcode::kJSConvertReceiver:
307 case IrOpcode::kJSGetSuperConstructor: 307 case IrOpcode::kJSGetSuperConstructor:
308 case IrOpcode::kJSToObject: 308 case IrOpcode::kJSToObject: {
309 return false;
310 default:
311 break;
312 }
313 for (Node* dominator = effect;;) {
314 if (dominator->opcode() == IrOpcode::kCheckMaps &&
315 NodeProperties::IsSame(dominator->InputAt(0), receiver)) {
316 // Check if all maps have the given {instance_type}.
317 ZoneHandleSet<Map> const& maps =
318 CheckMapsParametersOf(dominator->op()).maps();
319 for (size_t i = 0; i < maps.size(); ++i) {
320 if (!maps[i]->IsJSReceiverMap()) return true;
321 }
322 return false; 309 return false;
323 } 310 }
324 switch (dominator->opcode()) { 311 default: {
325 case IrOpcode::kStoreField: { 312 ZoneHandleSet<Map> maps;
326 FieldAccess const& access = FieldAccessOf(dominator->op()); 313 if (NodeProperties::InferReceiverMaps(receiver, effect, &maps)) {
327 if (access.base_is_tagged == kTaggedBase && 314 // Check if all {maps} are actually JSReceiver maps.
328 access.offset == HeapObject::kMapOffset) { 315 for (size_t i = 0; i < maps.size(); ++i) {
329 return true; 316 if (!maps[i]->IsJSReceiverMap()) return true;
330 } 317 }
331 break; 318 return false;
332 } 319 }
333 case IrOpcode::kStoreElement: 320 return true;
334 case IrOpcode::kStoreTypedElement:
335 break;
336 default: {
337 DCHECK_EQ(1, dominator->op()->EffectOutputCount());
338 if (dominator->op()->EffectInputCount() != 1 ||
339 !dominator->op()->HasProperty(Operator::kNoWrite)) {
340 // Didn't find any appropriate CheckMaps node.
341 return true;
342 }
343 break;
344 }
345 } 321 }
346 dominator = NodeProperties::GetEffectInput(dominator);
347 } 322 }
348 } 323 }
349 324
350 // TODO(mstarzinger,verwaest): Move this predicate onto SharedFunctionInfo? 325 // TODO(mstarzinger,verwaest): Move this predicate onto SharedFunctionInfo?
351 bool NeedsImplicitReceiver(Handle<SharedFunctionInfo> shared_info) { 326 bool NeedsImplicitReceiver(Handle<SharedFunctionInfo> shared_info) {
352 DisallowHeapAllocation no_gc; 327 DisallowHeapAllocation no_gc;
353 Isolate* const isolate = shared_info->GetIsolate(); 328 Isolate* const isolate = shared_info->GetIsolate();
354 Code* const construct_stub = shared_info->construct_stub(); 329 Code* const construct_stub = shared_info->construct_stub();
355 return construct_stub != *isolate->builtins()->JSBuiltinsConstructStub() && 330 return construct_stub != *isolate->builtins()->JSBuiltinsConstructStub() &&
356 construct_stub != 331 construct_stub !=
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 730
756 CommonOperatorBuilder* JSInliner::common() const { return jsgraph()->common(); } 731 CommonOperatorBuilder* JSInliner::common() const { return jsgraph()->common(); }
757 732
758 SimplifiedOperatorBuilder* JSInliner::simplified() const { 733 SimplifiedOperatorBuilder* JSInliner::simplified() const {
759 return jsgraph()->simplified(); 734 return jsgraph()->simplified();
760 } 735 }
761 736
762 } // namespace compiler 737 } // namespace compiler
763 } // namespace internal 738 } // namespace internal
764 } // namespace v8 739 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-call-reducer.cc ('k') | src/compiler/js-native-context-specialization.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698