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

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

Issue 871693002: MIPS: new classes: change semantics of super(...) call and add new.target to construct stub. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed nits. Created 5 years, 11 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/mips64/code-stubs-mips64.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 3127 matching lines...) Expand 10 before | Expand all | Expand 10 after
3138 PreservePositionScope scope(masm()->positions_recorder()); 3138 PreservePositionScope scope(masm()->positions_recorder());
3139 VisitForStackValue(property->obj()); 3139 VisitForStackValue(property->obj());
3140 } 3140 }
3141 if (is_named_call) { 3141 if (is_named_call) {
3142 EmitCallWithLoadIC(expr); 3142 EmitCallWithLoadIC(expr);
3143 } else { 3143 } else {
3144 EmitKeyedCallWithLoadIC(expr, property->key()); 3144 EmitKeyedCallWithLoadIC(expr, property->key());
3145 } 3145 }
3146 } 3146 }
3147 } else if (call_type == Call::SUPER_CALL) { 3147 } else if (call_type == Call::SUPER_CALL) {
3148 SuperReference* super_ref = callee->AsSuperReference(); 3148 if (FLAG_experimental_classes) {
3149 EmitLoadSuperConstructor(super_ref); 3149 EmitSuperConstructorCall(expr);
3150 __ Push(result_register()); 3150 } else {
3151 VisitForStackValue(super_ref->this_var()); 3151 SuperReference* super_ref = callee->AsSuperReference();
3152 EmitCall(expr, CallICState::METHOD); 3152 EmitLoadSuperConstructor(super_ref);
3153 __ Push(result_register());
3154 VisitForStackValue(super_ref->this_var());
3155 EmitCall(expr, CallICState::METHOD);
3156 }
3153 } else { 3157 } else {
3154 DCHECK(call_type == Call::OTHER_CALL); 3158 DCHECK(call_type == Call::OTHER_CALL);
3155 // Call to an arbitrary expression not handled specially above. 3159 // Call to an arbitrary expression not handled specially above.
3156 { PreservePositionScope scope(masm()->positions_recorder()); 3160 { PreservePositionScope scope(masm()->positions_recorder());
3157 VisitForStackValue(callee); 3161 VisitForStackValue(callee);
3158 } 3162 }
3159 __ LoadRoot(a1, Heap::kUndefinedValueRootIndex); 3163 __ LoadRoot(a1, Heap::kUndefinedValueRootIndex);
3160 __ push(a1); 3164 __ push(a1);
3161 // Emit function call. 3165 // Emit function call.
3162 EmitCall(expr); 3166 EmitCall(expr);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
3209 __ li(a2, FeedbackVector()); 3213 __ li(a2, FeedbackVector());
3210 __ li(a3, Operand(SmiFromSlot(expr->CallNewFeedbackSlot()))); 3214 __ li(a3, Operand(SmiFromSlot(expr->CallNewFeedbackSlot())));
3211 3215
3212 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); 3216 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET);
3213 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 3217 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3214 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); 3218 PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
3215 context()->Plug(v0); 3219 context()->Plug(v0);
3216 } 3220 }
3217 3221
3218 3222
3223 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
3224 SuperReference* super_ref = expr->expression()->AsSuperReference();
3225 EmitLoadSuperConstructor(super_ref);
3226 __ push(result_register());
3227
3228 // Push the arguments ("left-to-right") on the stack.
3229 ZoneList<Expression*>* args = expr->arguments();
3230 int arg_count = args->length();
3231 for (int i = 0; i < arg_count; i++) {
3232 VisitForStackValue(args->at(i));
3233 }
3234
3235 // Call the construct call builtin that handles allocation and
3236 // constructor invocation.
3237 SetSourcePosition(expr->position());
3238
3239 // Load function and argument count into a1 and a0.
3240 __ li(a0, Operand(arg_count));
3241 __ ld(a1, MemOperand(sp, arg_count * kPointerSize));
3242
3243 // Record call targets in unoptimized code.
3244 if (FLAG_pretenuring_call_new) {
3245 UNREACHABLE();
3246 /* TODO(dslomov): support pretenuring.
3247 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot());
3248 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() ==
3249 expr->CallNewFeedbackSlot().ToInt() + 1);
3250 */
3251 }
3252
3253 __ li(a2, FeedbackVector());
3254 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackSlot())));
3255
3256 // TODO(dslomov): use a different stub and propagate new.target.
3257 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET);
3258 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3259
3260 RecordJSReturnSite(expr);
3261
3262 // TODO(dslomov): implement TDZ for `this`.
3263 EmitVariableAssignment(super_ref->this_var()->var(), Token::ASSIGN);
3264 context()->Plug(v0);
3265 }
3266
3267
3219 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 3268 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
3220 ZoneList<Expression*>* args = expr->arguments(); 3269 ZoneList<Expression*>* args = expr->arguments();
3221 DCHECK(args->length() == 1); 3270 DCHECK(args->length() == 1);
3222 3271
3223 VisitForAccumulatorValue(args->at(0)); 3272 VisitForAccumulatorValue(args->at(0));
3224 3273
3225 Label materialize_true, materialize_false; 3274 Label materialize_true, materialize_false;
3226 Label* if_true = NULL; 3275 Label* if_true = NULL;
3227 Label* if_false = NULL; 3276 Label* if_false = NULL;
3228 Label* fall_through = NULL; 3277 Label* fall_through = NULL;
(...skipping 2074 matching lines...) Expand 10 before | Expand all | Expand 10 after
5303 Assembler::target_address_at(pc_immediate_load_address)) == 5352 Assembler::target_address_at(pc_immediate_load_address)) ==
5304 reinterpret_cast<uint64_t>( 5353 reinterpret_cast<uint64_t>(
5305 isolate->builtins()->OsrAfterStackCheck()->entry())); 5354 isolate->builtins()->OsrAfterStackCheck()->entry()));
5306 return OSR_AFTER_STACK_CHECK; 5355 return OSR_AFTER_STACK_CHECK;
5307 } 5356 }
5308 5357
5309 5358
5310 } } // namespace v8::internal 5359 } } // namespace v8::internal
5311 5360
5312 #endif // V8_TARGET_ARCH_MIPS64 5361 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips64/code-stubs-mips64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698