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

Side by Side Diff: src/arm64/full-codegen-arm64.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/arm64/code-stubs-arm64.cc ('k') | src/compiler.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_ARM64 7 #if V8_TARGET_ARCH_ARM64
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 2844 matching lines...) Expand 10 before | Expand all | Expand 10 after
2855 PreservePositionScope scope(masm()->positions_recorder()); 2855 PreservePositionScope scope(masm()->positions_recorder());
2856 VisitForStackValue(property->obj()); 2856 VisitForStackValue(property->obj());
2857 } 2857 }
2858 if (is_named_call) { 2858 if (is_named_call) {
2859 EmitCallWithLoadIC(expr); 2859 EmitCallWithLoadIC(expr);
2860 } else { 2860 } else {
2861 EmitKeyedCallWithLoadIC(expr, property->key()); 2861 EmitKeyedCallWithLoadIC(expr, property->key());
2862 } 2862 }
2863 } 2863 }
2864 } else if (call_type == Call::SUPER_CALL) { 2864 } else if (call_type == Call::SUPER_CALL) {
2865 SuperReference* super_ref = callee->AsSuperReference(); 2865 if (FLAG_experimental_classes) {
2866 EmitLoadSuperConstructor(super_ref); 2866 EmitSuperConstructorCall(expr);
2867 __ Push(result_register()); 2867 } else {
2868 VisitForStackValue(super_ref->this_var()); 2868 SuperReference* super_ref = callee->AsSuperReference();
2869 EmitCall(expr, CallICState::METHOD); 2869 EmitLoadSuperConstructor(super_ref);
2870 __ Push(result_register());
2871 VisitForStackValue(super_ref->this_var());
2872 EmitCall(expr, CallICState::METHOD);
2873 }
2870 } else { 2874 } else {
2871 DCHECK(call_type == Call::OTHER_CALL); 2875 DCHECK(call_type == Call::OTHER_CALL);
2872 // Call to an arbitrary expression not handled specially above. 2876 // Call to an arbitrary expression not handled specially above.
2873 { PreservePositionScope scope(masm()->positions_recorder()); 2877 { PreservePositionScope scope(masm()->positions_recorder());
2874 VisitForStackValue(callee); 2878 VisitForStackValue(callee);
2875 } 2879 }
2876 __ LoadRoot(x1, Heap::kUndefinedValueRootIndex); 2880 __ LoadRoot(x1, Heap::kUndefinedValueRootIndex);
2877 __ Push(x1); 2881 __ Push(x1);
2878 // Emit function call. 2882 // Emit function call.
2879 EmitCall(expr); 2883 EmitCall(expr);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2927 __ LoadObject(x2, FeedbackVector()); 2931 __ LoadObject(x2, FeedbackVector());
2928 __ Mov(x3, SmiFromSlot(expr->CallNewFeedbackSlot())); 2932 __ Mov(x3, SmiFromSlot(expr->CallNewFeedbackSlot()));
2929 2933
2930 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); 2934 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET);
2931 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 2935 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
2932 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); 2936 PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
2933 context()->Plug(x0); 2937 context()->Plug(x0);
2934 } 2938 }
2935 2939
2936 2940
2941 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
2942 SuperReference* super_ref = expr->expression()->AsSuperReference();
2943 EmitLoadSuperConstructor(super_ref);
2944 __ push(result_register());
2945
2946 // Push the arguments ("left-to-right") on the stack.
2947 ZoneList<Expression*>* args = expr->arguments();
2948 int arg_count = args->length();
2949 for (int i = 0; i < arg_count; i++) {
2950 VisitForStackValue(args->at(i));
2951 }
2952
2953 // Call the construct call builtin that handles allocation and
2954 // constructor invocation.
2955 SetSourcePosition(expr->position());
2956
2957 // Load function and argument count into x1 and x0.
2958 __ Mov(x0, arg_count);
2959 __ Peek(x1, arg_count * kXRegSize);
2960
2961 // Record call targets in unoptimized code.
2962 if (FLAG_pretenuring_call_new) {
2963 UNREACHABLE();
2964 /* TODO(dslomov): support pretenuring.
2965 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot());
2966 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() ==
2967 expr->CallNewFeedbackSlot().ToInt() + 1);
2968 */
2969 }
2970
2971 __ LoadObject(x2, FeedbackVector());
2972 __ Mov(x3, SmiFromSlot(expr->CallFeedbackSlot()));
2973
2974 // TODO(dslomov): use a different stub and propagate new.target.
2975 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET);
2976 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
2977
2978 RecordJSReturnSite(expr);
2979
2980 // TODO(dslomov): implement TDZ for `this`.
2981 EmitVariableAssignment(super_ref->this_var()->var(), Token::ASSIGN);
2982 context()->Plug(x0);
2983 }
2984
2985
2937 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 2986 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
2938 ZoneList<Expression*>* args = expr->arguments(); 2987 ZoneList<Expression*>* args = expr->arguments();
2939 DCHECK(args->length() == 1); 2988 DCHECK(args->length() == 1);
2940 2989
2941 VisitForAccumulatorValue(args->at(0)); 2990 VisitForAccumulatorValue(args->at(0));
2942 2991
2943 Label materialize_true, materialize_false; 2992 Label materialize_true, materialize_false;
2944 Label* if_true = NULL; 2993 Label* if_true = NULL;
2945 Label* if_false = NULL; 2994 Label* if_false = NULL;
2946 Label* fall_through = NULL; 2995 Label* fall_through = NULL;
(...skipping 2394 matching lines...) Expand 10 before | Expand all | Expand 10 after
5341 return previous_; 5390 return previous_;
5342 } 5391 }
5343 5392
5344 5393
5345 #undef __ 5394 #undef __
5346 5395
5347 5396
5348 } } // namespace v8::internal 5397 } } // namespace v8::internal
5349 5398
5350 #endif // V8_TARGET_ARCH_ARM64 5399 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm64/code-stubs-arm64.cc ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698