OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/full-codegen/full-codegen.h" | 5 #include "src/full-codegen/full-codegen.h" |
6 | 6 |
7 #include "src/ast.h" | 7 #include "src/ast.h" |
8 #include "src/ast-numbering.h" | 8 #include "src/ast-numbering.h" |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 VisitForAccumulatorValue(expr); | 945 VisitForAccumulatorValue(expr); |
946 EmitUnwindBeforeReturn(); | 946 EmitUnwindBeforeReturn(); |
947 EmitReturnSequence(); | 947 EmitReturnSequence(); |
948 } | 948 } |
949 | 949 |
950 | 950 |
951 void FullCodeGenerator::VisitWithStatement(WithStatement* stmt) { | 951 void FullCodeGenerator::VisitWithStatement(WithStatement* stmt) { |
952 Comment cmnt(masm_, "[ WithStatement"); | 952 Comment cmnt(masm_, "[ WithStatement"); |
953 SetStatementPosition(stmt); | 953 SetStatementPosition(stmt); |
954 | 954 |
955 VisitForStackValue(stmt->expression()); | 955 VisitForAccumulatorValue(stmt->expression()); |
| 956 Callable callable = CodeFactory::ToObject(isolate()); |
| 957 __ Move(callable.descriptor().GetRegisterParameter(0), result_register()); |
| 958 __ Call(callable.code(), RelocInfo::CODE_TARGET); |
| 959 PrepareForBailoutForId(stmt->ToObjectId(), NO_REGISTERS); |
| 960 __ Push(result_register()); |
956 PushFunctionArgumentForContextAllocation(); | 961 PushFunctionArgumentForContextAllocation(); |
957 __ CallRuntime(Runtime::kPushWithContext, 2); | 962 __ CallRuntime(Runtime::kPushWithContext, 2); |
958 StoreToFrameField(StandardFrameConstants::kContextOffset, context_register()); | 963 StoreToFrameField(StandardFrameConstants::kContextOffset, context_register()); |
959 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); | 964 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); |
960 | 965 |
961 Scope* saved_scope = scope(); | 966 Scope* saved_scope = scope(); |
962 scope_ = stmt->scope(); | 967 scope_ = stmt->scope(); |
963 { WithOrCatch body(this); | 968 { WithOrCatch body(this); |
964 Visit(stmt->statement()); | 969 Visit(stmt->statement()); |
965 } | 970 } |
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1737 return var->mode() == CONST_LEGACY || var->scope()->is_nonlinear() || | 1742 return var->mode() == CONST_LEGACY || var->scope()->is_nonlinear() || |
1738 var->initializer_position() >= proxy->position(); | 1743 var->initializer_position() >= proxy->position(); |
1739 } | 1744 } |
1740 | 1745 |
1741 | 1746 |
1742 #undef __ | 1747 #undef __ |
1743 | 1748 |
1744 | 1749 |
1745 } // namespace internal | 1750 } // namespace internal |
1746 } // namespace v8 | 1751 } // namespace v8 |
OLD | NEW |