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

Side by Side Diff: src/arm/full-codegen-arm.cc

Issue 665773003: Classes: implement 'new super'. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: debug compilation fixed Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/arm64/full-codegen-arm64.cc » ('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 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/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_ARM 7 #if V8_TARGET_ARCH_ARM
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 2946 matching lines...) Expand 10 before | Expand all | Expand 10 after
2957 2957
2958 // r1: the start position of the scope the calls resides in. 2958 // r1: the start position of the scope the calls resides in.
2959 __ mov(r1, Operand(Smi::FromInt(scope()->start_position()))); 2959 __ mov(r1, Operand(Smi::FromInt(scope()->start_position())));
2960 2960
2961 // Do the runtime call. 2961 // Do the runtime call.
2962 __ Push(r4, r3, r2, r1); 2962 __ Push(r4, r3, r2, r1);
2963 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); 2963 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5);
2964 } 2964 }
2965 2965
2966 2966
2967 void FullCodeGenerator::EmitLoadSuperConstructor(SuperReference* super_ref) {
2968 DCHECK(super_ref != NULL);
2969 __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
2970 __ Push(r0);
2971 __ CallRuntime(Runtime::kGetPrototype, 1);
2972 }
2973
2974
2967 void FullCodeGenerator::VisitCall(Call* expr) { 2975 void FullCodeGenerator::VisitCall(Call* expr) {
2968 #ifdef DEBUG 2976 #ifdef DEBUG
2969 // We want to verify that RecordJSReturnSite gets called on all paths 2977 // We want to verify that RecordJSReturnSite gets called on all paths
2970 // through this function. Avoid early returns. 2978 // through this function. Avoid early returns.
2971 expr->return_is_recorded_ = false; 2979 expr->return_is_recorded_ = false;
2972 #endif 2980 #endif
2973 2981
2974 Comment cmnt(masm_, "[ Call"); 2982 Comment cmnt(masm_, "[ Call");
2975 Expression* callee = expr->expression(); 2983 Expression* callee = expr->expression();
2976 Call::CallType call_type = expr->GetCallType(isolate()); 2984 Call::CallType call_type = expr->GetCallType(isolate());
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
3074 VisitForStackValue(property->obj()); 3082 VisitForStackValue(property->obj());
3075 } 3083 }
3076 if (is_named_call) { 3084 if (is_named_call) {
3077 EmitCallWithLoadIC(expr); 3085 EmitCallWithLoadIC(expr);
3078 } else { 3086 } else {
3079 EmitKeyedCallWithLoadIC(expr, property->key()); 3087 EmitKeyedCallWithLoadIC(expr, property->key());
3080 } 3088 }
3081 } 3089 }
3082 } else if (call_type == Call::SUPER_CALL) { 3090 } else if (call_type == Call::SUPER_CALL) {
3083 SuperReference* super_ref = callee->AsSuperReference(); 3091 SuperReference* super_ref = callee->AsSuperReference();
3084 DCHECK(super_ref != NULL); 3092 EmitLoadSuperConstructor(super_ref);
3085 __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
3086 __ Push(r0);
3087 __ CallRuntime(Runtime::kGetPrototype, 1);
3088 __ Push(result_register()); 3093 __ Push(result_register());
3089 VisitForStackValue(super_ref->this_var()); 3094 VisitForStackValue(super_ref->this_var());
3090 EmitCall(expr, CallICState::METHOD); 3095 EmitCall(expr, CallICState::METHOD);
3091 } else { 3096 } else {
3092 DCHECK(call_type == Call::OTHER_CALL); 3097 DCHECK(call_type == Call::OTHER_CALL);
3093 // Call to an arbitrary expression not handled specially above. 3098 // Call to an arbitrary expression not handled specially above.
3094 { PreservePositionScope scope(masm()->positions_recorder()); 3099 { PreservePositionScope scope(masm()->positions_recorder());
3095 VisitForStackValue(callee); 3100 VisitForStackValue(callee);
3096 } 3101 }
3097 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); 3102 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex);
(...skipping 11 matching lines...) Expand all
3109 3114
3110 void FullCodeGenerator::VisitCallNew(CallNew* expr) { 3115 void FullCodeGenerator::VisitCallNew(CallNew* expr) {
3111 Comment cmnt(masm_, "[ CallNew"); 3116 Comment cmnt(masm_, "[ CallNew");
3112 // According to ECMA-262, section 11.2.2, page 44, the function 3117 // According to ECMA-262, section 11.2.2, page 44, the function
3113 // expression in new calls must be evaluated before the 3118 // expression in new calls must be evaluated before the
3114 // arguments. 3119 // arguments.
3115 3120
3116 // Push constructor on the stack. If it's not a function it's used as 3121 // Push constructor on the stack. If it's not a function it's used as
3117 // receiver for CALL_NON_FUNCTION, otherwise the value on the stack is 3122 // receiver for CALL_NON_FUNCTION, otherwise the value on the stack is
3118 // ignored. 3123 // ignored.
3119 VisitForStackValue(expr->expression()); 3124 if (expr->expression()->IsSuperReference()) {
3125 EmitLoadSuperConstructor(expr->expression()->AsSuperReference());
3126 __ Push(result_register());
3127 } else {
3128 VisitForStackValue(expr->expression());
3129 }
3120 3130
3121 // Push the arguments ("left-to-right") on the stack. 3131 // Push the arguments ("left-to-right") on the stack.
3122 ZoneList<Expression*>* args = expr->arguments(); 3132 ZoneList<Expression*>* args = expr->arguments();
3123 int arg_count = args->length(); 3133 int arg_count = args->length();
3124 for (int i = 0; i < arg_count; i++) { 3134 for (int i = 0; i < arg_count; i++) {
3125 VisitForStackValue(args->at(i)); 3135 VisitForStackValue(args->at(i));
3126 } 3136 }
3127 3137
3128 // Call the construct call builtin that handles allocation and 3138 // Call the construct call builtin that handles allocation and
3129 // constructor invocation. 3139 // constructor invocation.
(...skipping 2135 matching lines...) Expand 10 before | Expand all | Expand 10 after
5265 5275
5266 DCHECK(interrupt_address == 5276 DCHECK(interrupt_address ==
5267 isolate->builtins()->OsrAfterStackCheck()->entry()); 5277 isolate->builtins()->OsrAfterStackCheck()->entry());
5268 return OSR_AFTER_STACK_CHECK; 5278 return OSR_AFTER_STACK_CHECK;
5269 } 5279 }
5270 5280
5271 5281
5272 } } // namespace v8::internal 5282 } } // namespace v8::internal
5273 5283
5274 #endif // V8_TARGET_ARCH_ARM 5284 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm64/full-codegen-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698