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

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

Issue 676703002: MIPS: Classes: implement 'new super'. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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/mips64/full-codegen-mips64.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_MIPS 7 #if V8_TARGET_ARCH_MIPS
8 8
9 // Note on Mips implementation: 9 // Note on Mips implementation:
10 // 10 //
(...skipping 2921 matching lines...) Expand 10 before | Expand all | Expand 10 after
2932 2932
2933 // a1: the start position of the scope the calls resides in. 2933 // a1: the start position of the scope the calls resides in.
2934 __ li(a1, Operand(Smi::FromInt(scope()->start_position()))); 2934 __ li(a1, Operand(Smi::FromInt(scope()->start_position())));
2935 2935
2936 // Do the runtime call. 2936 // Do the runtime call.
2937 __ Push(t2, t1, t0, a1); 2937 __ Push(t2, t1, t0, a1);
2938 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); 2938 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5);
2939 } 2939 }
2940 2940
2941 2941
2942 void FullCodeGenerator::EmitLoadSuperConstructor(SuperReference* super_ref) {
2943 DCHECK(super_ref != NULL);
2944 __ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
2945 __ Push(a0);
2946 __ CallRuntime(Runtime::kGetPrototype, 1);
2947 }
2948
2949
2942 void FullCodeGenerator::VisitCall(Call* expr) { 2950 void FullCodeGenerator::VisitCall(Call* expr) {
2943 #ifdef DEBUG 2951 #ifdef DEBUG
2944 // We want to verify that RecordJSReturnSite gets called on all paths 2952 // We want to verify that RecordJSReturnSite gets called on all paths
2945 // through this function. Avoid early returns. 2953 // through this function. Avoid early returns.
2946 expr->return_is_recorded_ = false; 2954 expr->return_is_recorded_ = false;
2947 #endif 2955 #endif
2948 2956
2949 Comment cmnt(masm_, "[ Call"); 2957 Comment cmnt(masm_, "[ Call");
2950 Expression* callee = expr->expression(); 2958 Expression* callee = expr->expression();
2951 Call::CallType call_type = expr->GetCallType(isolate()); 2959 Call::CallType call_type = expr->GetCallType(isolate());
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
3047 VisitForStackValue(property->obj()); 3055 VisitForStackValue(property->obj());
3048 } 3056 }
3049 if (is_named_call) { 3057 if (is_named_call) {
3050 EmitCallWithLoadIC(expr); 3058 EmitCallWithLoadIC(expr);
3051 } else { 3059 } else {
3052 EmitKeyedCallWithLoadIC(expr, property->key()); 3060 EmitKeyedCallWithLoadIC(expr, property->key());
3053 } 3061 }
3054 } 3062 }
3055 } else if (call_type == Call::SUPER_CALL) { 3063 } else if (call_type == Call::SUPER_CALL) {
3056 SuperReference* super_ref = callee->AsSuperReference(); 3064 SuperReference* super_ref = callee->AsSuperReference();
3057 DCHECK(super_ref != NULL); 3065 EmitLoadSuperConstructor(super_ref);
3058 __ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
3059 __ Push(a0);
3060 __ CallRuntime(Runtime::kGetPrototype, 1);
3061 __ Push(result_register()); 3066 __ Push(result_register());
3062 VisitForStackValue(super_ref->this_var()); 3067 VisitForStackValue(super_ref->this_var());
3063 EmitCall(expr, CallICState::METHOD); 3068 EmitCall(expr, CallICState::METHOD);
3064 } else { 3069 } else {
3065 DCHECK(call_type == Call::OTHER_CALL); 3070 DCHECK(call_type == Call::OTHER_CALL);
3066 // Call to an arbitrary expression not handled specially above. 3071 // Call to an arbitrary expression not handled specially above.
3067 { PreservePositionScope scope(masm()->positions_recorder()); 3072 { PreservePositionScope scope(masm()->positions_recorder());
3068 VisitForStackValue(callee); 3073 VisitForStackValue(callee);
3069 } 3074 }
3070 __ LoadRoot(a1, Heap::kUndefinedValueRootIndex); 3075 __ LoadRoot(a1, Heap::kUndefinedValueRootIndex);
(...skipping 11 matching lines...) Expand all
3082 3087
3083 void FullCodeGenerator::VisitCallNew(CallNew* expr) { 3088 void FullCodeGenerator::VisitCallNew(CallNew* expr) {
3084 Comment cmnt(masm_, "[ CallNew"); 3089 Comment cmnt(masm_, "[ CallNew");
3085 // According to ECMA-262, section 11.2.2, page 44, the function 3090 // According to ECMA-262, section 11.2.2, page 44, the function
3086 // expression in new calls must be evaluated before the 3091 // expression in new calls must be evaluated before the
3087 // arguments. 3092 // arguments.
3088 3093
3089 // Push constructor on the stack. If it's not a function it's used as 3094 // Push constructor on the stack. If it's not a function it's used as
3090 // receiver for CALL_NON_FUNCTION, otherwise the value on the stack is 3095 // receiver for CALL_NON_FUNCTION, otherwise the value on the stack is
3091 // ignored. 3096 // ignored.
3092 VisitForStackValue(expr->expression()); 3097 if (expr->expression()->IsSuperReference()) {
3098 EmitLoadSuperConstructor(expr->expression()->AsSuperReference());
3099 __ Push(result_register());
3100 } else {
3101 VisitForStackValue(expr->expression());
3102 }
3093 3103
3094 // Push the arguments ("left-to-right") on the stack. 3104 // Push the arguments ("left-to-right") on the stack.
3095 ZoneList<Expression*>* args = expr->arguments(); 3105 ZoneList<Expression*>* args = expr->arguments();
3096 int arg_count = args->length(); 3106 int arg_count = args->length();
3097 for (int i = 0; i < arg_count; i++) { 3107 for (int i = 0; i < arg_count; i++) {
3098 VisitForStackValue(args->at(i)); 3108 VisitForStackValue(args->at(i));
3099 } 3109 }
3100 3110
3101 // Call the construct call builtin that handles allocation and 3111 // Call the construct call builtin that handles allocation and
3102 // constructor invocation. 3112 // constructor invocation.
(...skipping 2100 matching lines...) Expand 10 before | Expand all | Expand 10 after
5203 Assembler::target_address_at(pc_immediate_load_address)) == 5213 Assembler::target_address_at(pc_immediate_load_address)) ==
5204 reinterpret_cast<uint32_t>( 5214 reinterpret_cast<uint32_t>(
5205 isolate->builtins()->OsrAfterStackCheck()->entry())); 5215 isolate->builtins()->OsrAfterStackCheck()->entry()));
5206 return OSR_AFTER_STACK_CHECK; 5216 return OSR_AFTER_STACK_CHECK;
5207 } 5217 }
5208 5218
5209 5219
5210 } } // namespace v8::internal 5220 } } // namespace v8::internal
5211 5221
5212 #endif // V8_TARGET_ARCH_MIPS 5222 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698