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

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

Issue 803933008: 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: Fix x64 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/arm/code-stubs-arm.cc ('k') | src/arm64/builtins-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 3155 matching lines...) Expand 10 before | Expand all | Expand 10 after
3166 PreservePositionScope scope(masm()->positions_recorder()); 3166 PreservePositionScope scope(masm()->positions_recorder());
3167 VisitForStackValue(property->obj()); 3167 VisitForStackValue(property->obj());
3168 } 3168 }
3169 if (is_named_call) { 3169 if (is_named_call) {
3170 EmitCallWithLoadIC(expr); 3170 EmitCallWithLoadIC(expr);
3171 } else { 3171 } else {
3172 EmitKeyedCallWithLoadIC(expr, property->key()); 3172 EmitKeyedCallWithLoadIC(expr, property->key());
3173 } 3173 }
3174 } 3174 }
3175 } else if (call_type == Call::SUPER_CALL) { 3175 } else if (call_type == Call::SUPER_CALL) {
3176 SuperReference* super_ref = callee->AsSuperReference(); 3176 if (FLAG_experimental_classes) {
3177 EmitLoadSuperConstructor(super_ref); 3177 EmitSuperConstructorCall(expr);
3178 __ Push(result_register()); 3178 } else {
3179 VisitForStackValue(super_ref->this_var()); 3179 SuperReference* super_ref = callee->AsSuperReference();
3180 EmitCall(expr, CallICState::METHOD); 3180 EmitLoadSuperConstructor(super_ref);
3181 __ Push(result_register());
3182 VisitForStackValue(super_ref->this_var());
3183 EmitCall(expr, CallICState::METHOD);
3184 }
3181 } else { 3185 } else {
3182 DCHECK(call_type == Call::OTHER_CALL); 3186 DCHECK(call_type == Call::OTHER_CALL);
3183 // Call to an arbitrary expression not handled specially above. 3187 // Call to an arbitrary expression not handled specially above.
3184 { PreservePositionScope scope(masm()->positions_recorder()); 3188 { PreservePositionScope scope(masm()->positions_recorder());
3185 VisitForStackValue(callee); 3189 VisitForStackValue(callee);
3186 } 3190 }
3187 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); 3191 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex);
3188 __ push(r1); 3192 __ push(r1);
3189 // Emit function call. 3193 // Emit function call.
3190 EmitCall(expr); 3194 EmitCall(expr);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
3238 __ Move(r2, FeedbackVector()); 3242 __ Move(r2, FeedbackVector());
3239 __ mov(r3, Operand(SmiFromSlot(expr->CallNewFeedbackSlot()))); 3243 __ mov(r3, Operand(SmiFromSlot(expr->CallNewFeedbackSlot())));
3240 3244
3241 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); 3245 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET);
3242 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 3246 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3243 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); 3247 PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
3244 context()->Plug(r0); 3248 context()->Plug(r0);
3245 } 3249 }
3246 3250
3247 3251
3252 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
3253 SuperReference* super_ref = expr->expression()->AsSuperReference();
3254 EmitLoadSuperConstructor(super_ref);
3255 __ push(result_register());
3256
3257 // Push the arguments ("left-to-right") on the stack.
3258 ZoneList<Expression*>* args = expr->arguments();
3259 int arg_count = args->length();
3260 for (int i = 0; i < arg_count; i++) {
3261 VisitForStackValue(args->at(i));
3262 }
3263
3264 // Call the construct call builtin that handles allocation and
3265 // constructor invocation.
3266 SetSourcePosition(expr->position());
3267
3268 // Load function and argument count into r1 and r0.
3269 __ mov(r0, Operand(arg_count));
3270 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize));
3271
3272 // Record call targets in unoptimized code.
3273 if (FLAG_pretenuring_call_new) {
3274 UNREACHABLE();
3275 /* TODO(dslomov): support pretenuring.
3276 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot());
3277 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() ==
3278 expr->CallNewFeedbackSlot().ToInt() + 1);
3279 */
3280 }
3281
3282 __ Move(r2, FeedbackVector());
3283 __ mov(r3, Operand(SmiFromSlot(expr->CallFeedbackSlot())));
3284
3285 // TODO(dslomov): use a different stub and propagate new.target.
3286 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET);
3287 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3288
3289 RecordJSReturnSite(expr);
3290
3291 // TODO(dslomov): implement TDZ for `this`.
3292 EmitVariableAssignment(super_ref->this_var()->var(), Token::ASSIGN);
3293 context()->Plug(r0);
3294 }
3295
3296
3248 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 3297 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
3249 ZoneList<Expression*>* args = expr->arguments(); 3298 ZoneList<Expression*>* args = expr->arguments();
3250 DCHECK(args->length() == 1); 3299 DCHECK(args->length() == 1);
3251 3300
3252 VisitForAccumulatorValue(args->at(0)); 3301 VisitForAccumulatorValue(args->at(0));
3253 3302
3254 Label materialize_true, materialize_false; 3303 Label materialize_true, materialize_false;
3255 Label* if_true = NULL; 3304 Label* if_true = NULL;
3256 Label* if_false = NULL; 3305 Label* if_false = NULL;
3257 Label* fall_through = NULL; 3306 Label* fall_through = NULL;
(...skipping 2103 matching lines...) Expand 10 before | Expand all | Expand 10 after
5361 5410
5362 DCHECK(interrupt_address == 5411 DCHECK(interrupt_address ==
5363 isolate->builtins()->OsrAfterStackCheck()->entry()); 5412 isolate->builtins()->OsrAfterStackCheck()->entry());
5364 return OSR_AFTER_STACK_CHECK; 5413 return OSR_AFTER_STACK_CHECK;
5365 } 5414 }
5366 5415
5367 5416
5368 } } // namespace v8::internal 5417 } } // namespace v8::internal
5369 5418
5370 #endif // V8_TARGET_ARCH_ARM 5419 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/arm64/builtins-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698