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

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

Issue 914303003: MIPS: new classes: implement default constructors. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « src/mips/full-codegen-mips.cc ('k') | no next file » | 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_MIPS64 7 #if V8_TARGET_ARCH_MIPS64
8 8
9 // Note on Mips implementation: 9 // Note on Mips implementation:
10 // 10 //
(...skipping 3022 matching lines...) Expand 10 before | Expand all | Expand 10 after
3033 // a1: the start position of the scope the calls resides in. 3033 // a1: the start position of the scope the calls resides in.
3034 __ li(a1, Operand(Smi::FromInt(scope()->start_position()))); 3034 __ li(a1, Operand(Smi::FromInt(scope()->start_position())));
3035 3035
3036 // Do the runtime call. 3036 // Do the runtime call.
3037 __ Push(a7); 3037 __ Push(a7);
3038 __ Push(a6, a5, a4, a1); 3038 __ Push(a6, a5, a4, a1);
3039 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 6); 3039 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 6);
3040 } 3040 }
3041 3041
3042 3042
3043 void FullCodeGenerator::EmitLoadSuperConstructor(SuperReference* super_ref) { 3043 void FullCodeGenerator::EmitLoadSuperConstructor() {
3044 DCHECK(super_ref != NULL);
3045 __ ld(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 3044 __ ld(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
3046 __ Push(a0); 3045 __ Push(a0);
3047 __ CallRuntime(Runtime::kGetPrototype, 1); 3046 __ CallRuntime(Runtime::kGetPrototype, 1);
3048 } 3047 }
3049 3048
3050 3049
3051 void FullCodeGenerator::VisitCall(Call* expr) { 3050 void FullCodeGenerator::VisitCall(Call* expr) {
3052 #ifdef DEBUG 3051 #ifdef DEBUG
3053 // We want to verify that RecordJSReturnSite gets called on all paths 3052 // We want to verify that RecordJSReturnSite gets called on all paths
3054 // through this function. Avoid early returns. 3053 // through this function. Avoid early returns.
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
3158 if (is_named_call) { 3157 if (is_named_call) {
3159 EmitCallWithLoadIC(expr); 3158 EmitCallWithLoadIC(expr);
3160 } else { 3159 } else {
3161 EmitKeyedCallWithLoadIC(expr, property->key()); 3160 EmitKeyedCallWithLoadIC(expr, property->key());
3162 } 3161 }
3163 } 3162 }
3164 } else if (call_type == Call::SUPER_CALL) { 3163 } else if (call_type == Call::SUPER_CALL) {
3165 if (FLAG_experimental_classes) { 3164 if (FLAG_experimental_classes) {
3166 EmitSuperConstructorCall(expr); 3165 EmitSuperConstructorCall(expr);
3167 } else { 3166 } else {
3167 EmitLoadSuperConstructor();
3168 __ Push(result_register());
3168 SuperReference* super_ref = callee->AsSuperReference(); 3169 SuperReference* super_ref = callee->AsSuperReference();
3169 EmitLoadSuperConstructor(super_ref);
3170 __ Push(result_register());
3171 VisitForStackValue(super_ref->this_var()); 3170 VisitForStackValue(super_ref->this_var());
3172 EmitCall(expr, CallICState::METHOD); 3171 EmitCall(expr, CallICState::METHOD);
3173 } 3172 }
3174 } else { 3173 } else {
3175 DCHECK(call_type == Call::OTHER_CALL); 3174 DCHECK(call_type == Call::OTHER_CALL);
3176 // Call to an arbitrary expression not handled specially above. 3175 // Call to an arbitrary expression not handled specially above.
3177 { PreservePositionScope scope(masm()->positions_recorder()); 3176 { PreservePositionScope scope(masm()->positions_recorder());
3178 VisitForStackValue(callee); 3177 VisitForStackValue(callee);
3179 } 3178 }
3180 __ LoadRoot(a1, Heap::kUndefinedValueRootIndex); 3179 __ LoadRoot(a1, Heap::kUndefinedValueRootIndex);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
3233 context()->Plug(v0); 3232 context()->Plug(v0);
3234 } 3233 }
3235 3234
3236 3235
3237 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { 3236 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
3238 Comment cmnt(masm_, "[ SuperConstructorCall"); 3237 Comment cmnt(masm_, "[ SuperConstructorCall");
3239 Variable* new_target_var = scope()->DeclarationScope()->new_target_var(); 3238 Variable* new_target_var = scope()->DeclarationScope()->new_target_var();
3240 GetVar(result_register(), new_target_var); 3239 GetVar(result_register(), new_target_var);
3241 __ Push(result_register()); 3240 __ Push(result_register());
3242 3241
3243 SuperReference* super_ref = expr->expression()->AsSuperReference(); 3242 EmitLoadSuperConstructor();
3244 EmitLoadSuperConstructor(super_ref);
3245 __ push(result_register()); 3243 __ push(result_register());
3246 3244
3245 SuperReference* super_ref = expr->expression()->AsSuperReference();
3247 Variable* this_var = super_ref->this_var()->var(); 3246 Variable* this_var = super_ref->this_var()->var();
3248 3247
3249 GetVar(a0, this_var); 3248 GetVar(a0, this_var);
3250 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 3249 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
3251 Label uninitialized_this; 3250 Label uninitialized_this;
3252 __ Branch(&uninitialized_this, eq, a0, Operand(at)); 3251 __ Branch(&uninitialized_this, eq, a0, Operand(at));
3253 __ li(a0, Operand(this_var->name())); 3252 __ li(a0, Operand(this_var->name()));
3254 __ Push(a0); 3253 __ Push(a0);
3255 __ CallRuntime(Runtime::kThrowReferenceError, 1); 3254 __ CallRuntime(Runtime::kThrowReferenceError, 1);
3256 __ bind(&uninitialized_this); 3255 __ bind(&uninitialized_this);
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
4169 4168
4170 __ bind(&runtime); 4169 __ bind(&runtime);
4171 __ push(v0); 4170 __ push(v0);
4172 __ CallRuntime(Runtime::kCall, args->length()); 4171 __ CallRuntime(Runtime::kCall, args->length());
4173 __ bind(&done); 4172 __ bind(&done);
4174 4173
4175 context()->Plug(v0); 4174 context()->Plug(v0);
4176 } 4175 }
4177 4176
4178 4177
4178 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) {
4179 Variable* new_target_var = scope()->DeclarationScope()->new_target_var();
4180 GetVar(result_register(), new_target_var);
4181 __ Push(result_register());
4182
4183 EmitLoadSuperConstructor();
4184 __ Push(result_register());
4185
4186 // Check if the calling frame is an arguments adaptor frame.
4187 Label adaptor_frame, args_set_up, runtime;
4188 __ ld(a2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
4189 __ ld(a3, MemOperand(a2, StandardFrameConstants::kContextOffset));
4190 __ Branch(&adaptor_frame, eq, a3,
4191 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
4192 // default constructor has no arguments, so no adaptor frame means no args.
4193 __ mov(a0, zero_reg);
4194 __ Branch(&args_set_up);
4195
4196 // Copy arguments from adaptor frame.
4197 {
4198 __ bind(&adaptor_frame);
4199 __ ld(a1, MemOperand(a2, ArgumentsAdaptorFrameConstants::kLengthOffset));
4200 __ SmiUntag(a1, a1);
4201
4202 // Subtract 1 from arguments count, for new.target.
4203 __ Daddu(a1, a1, Operand(-1));
4204 __ mov(a0, a1);
4205
4206 // Get arguments pointer in a2.
4207 __ dsll(at, a1, kPointerSizeLog2);
4208 __ Daddu(a2, a2, Operand(at));
4209 __ Daddu(a2, a2, Operand(StandardFrameConstants::kCallerSPOffset));
4210 Label loop;
4211 __ bind(&loop);
4212 // Pre-decrement a2 with kPointerSize on each iteration.
4213 // Pre-decrement in order to skip receiver.
4214 __ Daddu(a2, a2, Operand(-kPointerSize));
4215 __ ld(a3, MemOperand(a2));
4216 __ Push(a3);
4217 __ Daddu(a1, a1, Operand(-1));
4218 __ Branch(&loop, ne, a1, Operand(zero_reg));
4219 }
4220
4221 __ bind(&args_set_up);
4222 __ dsll(at, a0, kPointerSizeLog2);
4223 __ Daddu(at, at, Operand(sp));
4224 __ ld(a1, MemOperand(at, 0));
4225
4226 CallConstructStub stub(isolate(), SUPER_CONSTRUCTOR_CALL);
4227 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
4228
4229 __ Drop(1);
4230
4231 context()->Plug(result_register());
4232 }
4233
4234
4179 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) { 4235 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) {
4180 RegExpConstructResultStub stub(isolate()); 4236 RegExpConstructResultStub stub(isolate());
4181 ZoneList<Expression*>* args = expr->arguments(); 4237 ZoneList<Expression*>* args = expr->arguments();
4182 DCHECK(args->length() == 3); 4238 DCHECK(args->length() == 3);
4183 VisitForStackValue(args->at(0)); 4239 VisitForStackValue(args->at(0));
4184 VisitForStackValue(args->at(1)); 4240 VisitForStackValue(args->at(1));
4185 VisitForAccumulatorValue(args->at(2)); 4241 VisitForAccumulatorValue(args->at(2));
4186 __ mov(a0, result_register()); 4242 __ mov(a0, result_register());
4187 __ pop(a1); 4243 __ pop(a1);
4188 __ pop(a2); 4244 __ pop(a2);
(...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after
5381 Assembler::target_address_at(pc_immediate_load_address)) == 5437 Assembler::target_address_at(pc_immediate_load_address)) ==
5382 reinterpret_cast<uint64_t>( 5438 reinterpret_cast<uint64_t>(
5383 isolate->builtins()->OsrAfterStackCheck()->entry())); 5439 isolate->builtins()->OsrAfterStackCheck()->entry()));
5384 return OSR_AFTER_STACK_CHECK; 5440 return OSR_AFTER_STACK_CHECK;
5385 } 5441 }
5386 5442
5387 5443
5388 } } // namespace v8::internal 5444 } } // namespace v8::internal
5389 5445
5390 #endif // V8_TARGET_ARCH_MIPS64 5446 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/full-codegen-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698