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

Side by Side Diff: src/compiler/bytecode-graph-builder.cc

Issue 2802113003: [turbofan] Introduce a SpeculativeToNumber operator. (Closed)
Patch Set: Paint it green! Created 3 years, 8 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/bytecode-graph-builder.h ('k') | src/compiler/js-type-hint-lowering.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/bytecode-graph-builder.h" 5 #include "src/compiler/bytecode-graph-builder.h"
6 6
7 #include "src/ast/ast.h" 7 #include "src/ast/ast.h"
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/compiler/access-builder.h" 9 #include "src/compiler/access-builder.h"
10 #include "src/compiler/compiler-source-position-table.h" 10 #include "src/compiler/compiler-source-position-table.h"
(...skipping 2016 matching lines...) Expand 10 before | Expand all | Expand 10 after
2027 BuildCastOperator(javascript()->ToObject()); 2027 BuildCastOperator(javascript()->ToObject());
2028 } 2028 }
2029 2029
2030 void BytecodeGraphBuilder::VisitToNumber() { 2030 void BytecodeGraphBuilder::VisitToNumber() {
2031 PrepareEagerCheckpoint(); 2031 PrepareEagerCheckpoint();
2032 Node* object = environment()->LookupAccumulator(); 2032 Node* object = environment()->LookupAccumulator();
2033 2033
2034 Node* node = nullptr; 2034 Node* node = nullptr;
2035 FeedbackSlot slot = 2035 FeedbackSlot slot =
2036 feedback_vector()->ToSlot(bytecode_iterator().GetIndexOperand(1)); 2036 feedback_vector()->ToSlot(bytecode_iterator().GetIndexOperand(1));
2037 if (Node* simplified = TryBuildSimplifiedBinaryOp( 2037 if (Node* simplified = TryBuildSimplifiedToNumber(object, slot)) {
2038 javascript()->Multiply(), object, jsgraph()->OneConstant(), slot)) {
2039 node = simplified; 2038 node = simplified;
2040 } else { 2039 } else {
2041 node = NewNode(javascript()->ToNumber(), object); 2040 node = NewNode(javascript()->ToNumber(), object);
2042 } 2041 }
2043 2042
2044 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(0), node, 2043 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(0), node,
2045 Environment::kAttachFrameState); 2044 Environment::kAttachFrameState);
2046 } 2045 }
2047 2046
2048 void BytecodeGraphBuilder::VisitJump() { BuildJump(); } 2047 void BytecodeGraphBuilder::VisitJump() { BuildJump(); }
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
2455 Node* control = environment()->GetControlDependency(); 2454 Node* control = environment()->GetControlDependency();
2456 Reduction early_reduction = type_hint_lowering().ReduceBinaryOperation( 2455 Reduction early_reduction = type_hint_lowering().ReduceBinaryOperation(
2457 op, left, right, effect, control, slot); 2456 op, left, right, effect, control, slot);
2458 if (early_reduction.Changed()) { 2457 if (early_reduction.Changed()) {
2459 ApplyEarlyReduction(early_reduction); 2458 ApplyEarlyReduction(early_reduction);
2460 return early_reduction.replacement(); 2459 return early_reduction.replacement();
2461 } 2460 }
2462 return nullptr; 2461 return nullptr;
2463 } 2462 }
2464 2463
2464 Node* BytecodeGraphBuilder::TryBuildSimplifiedToNumber(Node* value,
2465 FeedbackSlot slot) {
2466 Node* effect = environment()->GetEffectDependency();
2467 Node* control = environment()->GetControlDependency();
2468 Reduction early_reduction = type_hint_lowering().ReduceToNumberOperation(
2469 value, effect, control, slot);
2470 if (early_reduction.Changed()) {
2471 ApplyEarlyReduction(early_reduction);
2472 return early_reduction.replacement();
2473 }
2474 return nullptr;
2475 }
2476
2465 Node* BytecodeGraphBuilder::TryBuildSimplifiedLoadNamed(const Operator* op, 2477 Node* BytecodeGraphBuilder::TryBuildSimplifiedLoadNamed(const Operator* op,
2466 Node* receiver, 2478 Node* receiver,
2467 FeedbackSlot slot) { 2479 FeedbackSlot slot) {
2468 // TODO(mstarzinger,6112): This is a workaround for OSR loop entries being 2480 // TODO(mstarzinger,6112): This is a workaround for OSR loop entries being
2469 // pruned from the graph by a soft-deopt. It can happen that a LoadIC that 2481 // pruned from the graph by a soft-deopt. It can happen that a LoadIC that
2470 // control-dominates the OSR entry is still in "uninitialized" state. 2482 // control-dominates the OSR entry is still in "uninitialized" state.
2471 if (!osr_ast_id_.IsNone()) return nullptr; 2483 if (!osr_ast_id_.IsNone()) return nullptr;
2472 Node* effect = environment()->GetEffectDependency(); 2484 Node* effect = environment()->GetEffectDependency();
2473 Node* control = environment()->GetControlDependency(); 2485 Node* control = environment()->GetControlDependency();
2474 Reduction early_reduction = type_hint_lowering().ReduceLoadNamedOperation( 2486 Reduction early_reduction = type_hint_lowering().ReduceLoadNamedOperation(
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
2748 it->source_position().ScriptOffset(), start_position_.InliningId())); 2760 it->source_position().ScriptOffset(), start_position_.InliningId()));
2749 it->Advance(); 2761 it->Advance();
2750 } else { 2762 } else {
2751 DCHECK_GT(it->code_offset(), offset); 2763 DCHECK_GT(it->code_offset(), offset);
2752 } 2764 }
2753 } 2765 }
2754 2766
2755 } // namespace compiler 2767 } // namespace compiler
2756 } // namespace internal 2768 } // namespace internal
2757 } // namespace v8 2769 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/bytecode-graph-builder.h ('k') | src/compiler/js-type-hint-lowering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698