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 3971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3982 } | 3982 } |
3983 } | 3983 } |
3984 | 3984 |
3985 | 3985 |
3986 // Implementation of utility classes to represent an expression's context in | 3986 // Implementation of utility classes to represent an expression's context in |
3987 // the AST. | 3987 // the AST. |
3988 AstContext::AstContext(HOptimizedGraphBuilder* owner, Expression::Context kind) | 3988 AstContext::AstContext(HOptimizedGraphBuilder* owner, Expression::Context kind) |
3989 : owner_(owner), | 3989 : owner_(owner), |
3990 kind_(kind), | 3990 kind_(kind), |
3991 outer_(owner->ast_context()), | 3991 outer_(owner->ast_context()), |
3992 for_typeof_(false) { | 3992 typeof_mode_(NOT_INSIDE_TYPEOF) { |
3993 owner->set_ast_context(this); // Push. | 3993 owner->set_ast_context(this); // Push. |
3994 #ifdef DEBUG | 3994 #ifdef DEBUG |
3995 DCHECK(owner->environment()->frame_type() == JS_FUNCTION); | 3995 DCHECK(owner->environment()->frame_type() == JS_FUNCTION); |
3996 original_length_ = owner->environment()->length(); | 3996 original_length_ = owner->environment()->length(); |
3997 #endif | 3997 #endif |
3998 } | 3998 } |
3999 | 3999 |
4000 | 4000 |
4001 AstContext::~AstContext() { | 4001 AstContext::~AstContext() { |
4002 owner_->set_ast_context(outer_); // Pop. | 4002 owner_->set_ast_context(outer_); // Pop. |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4230 | 4230 |
4231 void HOptimizedGraphBuilder::VisitForValue(Expression* expr, | 4231 void HOptimizedGraphBuilder::VisitForValue(Expression* expr, |
4232 ArgumentsAllowedFlag flag) { | 4232 ArgumentsAllowedFlag flag) { |
4233 ValueContext for_value(this, flag); | 4233 ValueContext for_value(this, flag); |
4234 Visit(expr); | 4234 Visit(expr); |
4235 } | 4235 } |
4236 | 4236 |
4237 | 4237 |
4238 void HOptimizedGraphBuilder::VisitForTypeOf(Expression* expr) { | 4238 void HOptimizedGraphBuilder::VisitForTypeOf(Expression* expr) { |
4239 ValueContext for_value(this, ARGUMENTS_NOT_ALLOWED); | 4239 ValueContext for_value(this, ARGUMENTS_NOT_ALLOWED); |
4240 for_value.set_for_typeof(true); | 4240 for_value.set_typeof_mode(INSIDE_TYPEOF); |
4241 Visit(expr); | 4241 Visit(expr); |
4242 } | 4242 } |
4243 | 4243 |
4244 | 4244 |
4245 void HOptimizedGraphBuilder::VisitForControl(Expression* expr, | 4245 void HOptimizedGraphBuilder::VisitForControl(Expression* expr, |
4246 HBasicBlock* true_block, | 4246 HBasicBlock* true_block, |
4247 HBasicBlock* false_block) { | 4247 HBasicBlock* false_block) { |
4248 TestContext for_test(this, expr, true_block, false_block); | 4248 TestContext for_test(this, expr, true_block, false_block); |
4249 Visit(expr); | 4249 Visit(expr); |
4250 } | 4250 } |
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5501 field_maps, HType::HeapObject()); | 5501 field_maps, HType::HeapObject()); |
5502 } | 5502 } |
5503 instr->ClearDependsOnFlag(kInobjectFields); | 5503 instr->ClearDependsOnFlag(kInobjectFields); |
5504 instr->SetDependsOnFlag(kGlobalVars); | 5504 instr->SetDependsOnFlag(kGlobalVars); |
5505 return ast_context()->ReturnInstruction(instr, expr->id()); | 5505 return ast_context()->ReturnInstruction(instr, expr->id()); |
5506 } | 5506 } |
5507 } else { | 5507 } else { |
5508 HValue* global_object = Add<HLoadNamedField>( | 5508 HValue* global_object = Add<HLoadNamedField>( |
5509 context(), nullptr, | 5509 context(), nullptr, |
5510 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); | 5510 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); |
5511 HLoadGlobalGeneric* instr = | 5511 HLoadGlobalGeneric* instr = New<HLoadGlobalGeneric>( |
5512 New<HLoadGlobalGeneric>(global_object, | 5512 global_object, variable->name(), ast_context()->typeof_mode()); |
5513 variable->name(), | |
5514 ast_context()->is_for_typeof()); | |
5515 instr->SetVectorAndSlot(handle(current_feedback_vector(), isolate()), | 5513 instr->SetVectorAndSlot(handle(current_feedback_vector(), isolate()), |
5516 expr->VariableFeedbackSlot()); | 5514 expr->VariableFeedbackSlot()); |
5517 return ast_context()->ReturnInstruction(instr, expr->id()); | 5515 return ast_context()->ReturnInstruction(instr, expr->id()); |
5518 } | 5516 } |
5519 } | 5517 } |
5520 | 5518 |
5521 case VariableLocation::PARAMETER: | 5519 case VariableLocation::PARAMETER: |
5522 case VariableLocation::LOCAL: { | 5520 case VariableLocation::LOCAL: { |
5523 HValue* value = LookupAndMakeLive(variable); | 5521 HValue* value = LookupAndMakeLive(variable); |
5524 if (value == graph()->GetConstantHole()) { | 5522 if (value == graph()->GetConstantHole()) { |
(...skipping 7720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13245 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13243 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13246 } | 13244 } |
13247 | 13245 |
13248 #ifdef DEBUG | 13246 #ifdef DEBUG |
13249 graph_->Verify(false); // No full verify. | 13247 graph_->Verify(false); // No full verify. |
13250 #endif | 13248 #endif |
13251 } | 13249 } |
13252 | 13250 |
13253 } // namespace internal | 13251 } // namespace internal |
13254 } // namespace v8 | 13252 } // namespace v8 |
OLD | NEW |