OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/hydrogen.h" | 5 #include "src/hydrogen.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 4026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4037 } | 4037 } |
4038 } | 4038 } |
4039 | 4039 |
4040 | 4040 |
4041 // Implementation of utility classes to represent an expression's context in | 4041 // Implementation of utility classes to represent an expression's context in |
4042 // the AST. | 4042 // the AST. |
4043 AstContext::AstContext(HOptimizedGraphBuilder* owner, Expression::Context kind) | 4043 AstContext::AstContext(HOptimizedGraphBuilder* owner, Expression::Context kind) |
4044 : owner_(owner), | 4044 : owner_(owner), |
4045 kind_(kind), | 4045 kind_(kind), |
4046 outer_(owner->ast_context()), | 4046 outer_(owner->ast_context()), |
4047 for_typeof_(false) { | 4047 typeof_mode_(NOT_INSIDE_TYPEOF) { |
4048 owner->set_ast_context(this); // Push. | 4048 owner->set_ast_context(this); // Push. |
4049 #ifdef DEBUG | 4049 #ifdef DEBUG |
4050 DCHECK(owner->environment()->frame_type() == JS_FUNCTION); | 4050 DCHECK(owner->environment()->frame_type() == JS_FUNCTION); |
4051 original_length_ = owner->environment()->length(); | 4051 original_length_ = owner->environment()->length(); |
4052 #endif | 4052 #endif |
4053 } | 4053 } |
4054 | 4054 |
4055 | 4055 |
4056 AstContext::~AstContext() { | 4056 AstContext::~AstContext() { |
4057 owner_->set_ast_context(outer_); // Pop. | 4057 owner_->set_ast_context(outer_); // Pop. |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4285 | 4285 |
4286 void HOptimizedGraphBuilder::VisitForValue(Expression* expr, | 4286 void HOptimizedGraphBuilder::VisitForValue(Expression* expr, |
4287 ArgumentsAllowedFlag flag) { | 4287 ArgumentsAllowedFlag flag) { |
4288 ValueContext for_value(this, flag); | 4288 ValueContext for_value(this, flag); |
4289 Visit(expr); | 4289 Visit(expr); |
4290 } | 4290 } |
4291 | 4291 |
4292 | 4292 |
4293 void HOptimizedGraphBuilder::VisitForTypeOf(Expression* expr) { | 4293 void HOptimizedGraphBuilder::VisitForTypeOf(Expression* expr) { |
4294 ValueContext for_value(this, ARGUMENTS_NOT_ALLOWED); | 4294 ValueContext for_value(this, ARGUMENTS_NOT_ALLOWED); |
4295 for_value.set_for_typeof(true); | 4295 for_value.set_typeof_mode(INSIDE_TYPEOF); |
4296 Visit(expr); | 4296 Visit(expr); |
4297 } | 4297 } |
4298 | 4298 |
4299 | 4299 |
4300 void HOptimizedGraphBuilder::VisitForControl(Expression* expr, | 4300 void HOptimizedGraphBuilder::VisitForControl(Expression* expr, |
4301 HBasicBlock* true_block, | 4301 HBasicBlock* true_block, |
4302 HBasicBlock* false_block) { | 4302 HBasicBlock* false_block) { |
4303 TestContext for_test(this, expr, true_block, false_block); | 4303 TestContext for_test(this, expr, true_block, false_block); |
4304 Visit(expr); | 4304 Visit(expr); |
4305 } | 4305 } |
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5556 field_maps, HType::HeapObject()); | 5556 field_maps, HType::HeapObject()); |
5557 } | 5557 } |
5558 instr->ClearDependsOnFlag(kInobjectFields); | 5558 instr->ClearDependsOnFlag(kInobjectFields); |
5559 instr->SetDependsOnFlag(kGlobalVars); | 5559 instr->SetDependsOnFlag(kGlobalVars); |
5560 return ast_context()->ReturnInstruction(instr, expr->id()); | 5560 return ast_context()->ReturnInstruction(instr, expr->id()); |
5561 } | 5561 } |
5562 } else { | 5562 } else { |
5563 HValue* global_object = Add<HLoadNamedField>( | 5563 HValue* global_object = Add<HLoadNamedField>( |
5564 context(), nullptr, | 5564 context(), nullptr, |
5565 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); | 5565 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); |
5566 HLoadGlobalGeneric* instr = | 5566 HLoadGlobalGeneric* instr = New<HLoadGlobalGeneric>( |
5567 New<HLoadGlobalGeneric>(global_object, | 5567 global_object, variable->name(), ast_context()->typeof_mode()); |
5568 variable->name(), | |
5569 ast_context()->is_for_typeof()); | |
5570 instr->SetVectorAndSlot(handle(current_feedback_vector(), isolate()), | 5568 instr->SetVectorAndSlot(handle(current_feedback_vector(), isolate()), |
5571 expr->VariableFeedbackSlot()); | 5569 expr->VariableFeedbackSlot()); |
5572 return ast_context()->ReturnInstruction(instr, expr->id()); | 5570 return ast_context()->ReturnInstruction(instr, expr->id()); |
5573 } | 5571 } |
5574 } | 5572 } |
5575 | 5573 |
5576 case VariableLocation::PARAMETER: | 5574 case VariableLocation::PARAMETER: |
5577 case VariableLocation::LOCAL: { | 5575 case VariableLocation::LOCAL: { |
5578 HValue* value = LookupAndMakeLive(variable); | 5576 HValue* value = LookupAndMakeLive(variable); |
5579 if (value == graph()->GetConstantHole()) { | 5577 if (value == graph()->GetConstantHole()) { |
(...skipping 7719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13299 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13297 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13300 } | 13298 } |
13301 | 13299 |
13302 #ifdef DEBUG | 13300 #ifdef DEBUG |
13303 graph_->Verify(false); // No full verify. | 13301 graph_->Verify(false); // No full verify. |
13304 #endif | 13302 #endif |
13305 } | 13303 } |
13306 | 13304 |
13307 } // namespace internal | 13305 } // namespace internal |
13308 } // namespace v8 | 13306 } // namespace v8 |
OLD | NEW |