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

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

Issue 662253003: Revert "Classes: implement 'new super'." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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 | « src/ia32/full-codegen-ia32.cc ('k') | test/mjsunit/harmony/super.js » ('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_X64 7 #if V8_TARGET_ARCH_X64
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 2849 matching lines...) Expand 10 before | Expand all | Expand 10 after
2860 __ Push(Smi::FromInt(strict_mode())); 2860 __ Push(Smi::FromInt(strict_mode()));
2861 2861
2862 // Push the start position of the scope the calls resides in. 2862 // Push the start position of the scope the calls resides in.
2863 __ Push(Smi::FromInt(scope()->start_position())); 2863 __ Push(Smi::FromInt(scope()->start_position()));
2864 2864
2865 // Do the runtime call. 2865 // Do the runtime call.
2866 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); 2866 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5);
2867 } 2867 }
2868 2868
2869 2869
2870 void FullCodeGenerator::EmitLoadSuperConstructor(SuperReference* expr) {
2871 DCHECK(super_ref != NULL);
2872 __ Push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
2873 __ CallRuntime(Runtime::kGetPrototype, 1);
2874 }
2875
2876
2877 void FullCodeGenerator::VisitCall(Call* expr) { 2870 void FullCodeGenerator::VisitCall(Call* expr) {
2878 #ifdef DEBUG 2871 #ifdef DEBUG
2879 // We want to verify that RecordJSReturnSite gets called on all paths 2872 // We want to verify that RecordJSReturnSite gets called on all paths
2880 // through this function. Avoid early returns. 2873 // through this function. Avoid early returns.
2881 expr->return_is_recorded_ = false; 2874 expr->return_is_recorded_ = false;
2882 #endif 2875 #endif
2883 2876
2884 Comment cmnt(masm_, "[ Call"); 2877 Comment cmnt(masm_, "[ Call");
2885 Expression* callee = expr->expression(); 2878 Expression* callee = expr->expression();
2886 Call::CallType call_type = expr->GetCallType(isolate()); 2879 Call::CallType call_type = expr->GetCallType(isolate());
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
2976 VisitForStackValue(property->obj()); 2969 VisitForStackValue(property->obj());
2977 } 2970 }
2978 if (is_named_call) { 2971 if (is_named_call) {
2979 EmitCallWithLoadIC(expr); 2972 EmitCallWithLoadIC(expr);
2980 } else { 2973 } else {
2981 EmitKeyedCallWithLoadIC(expr, property->key()); 2974 EmitKeyedCallWithLoadIC(expr, property->key());
2982 } 2975 }
2983 } 2976 }
2984 } else if (call_type == Call::SUPER_CALL) { 2977 } else if (call_type == Call::SUPER_CALL) {
2985 SuperReference* super_ref = callee->AsSuperReference(); 2978 SuperReference* super_ref = callee->AsSuperReference();
2986 EmitLoadSuperConstructor(super_ref); 2979 DCHECK(super_ref != NULL);
2980 __ Push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
2981 __ CallRuntime(Runtime::kGetPrototype, 1);
2987 __ Push(result_register()); 2982 __ Push(result_register());
2988 VisitForStackValue(super_ref->this_var()); 2983 VisitForStackValue(super_ref->this_var());
2989 EmitCall(expr, CallICState::METHOD); 2984 EmitCall(expr, CallICState::METHOD);
2990 } else { 2985 } else {
2991 DCHECK(call_type == Call::OTHER_CALL); 2986 DCHECK(call_type == Call::OTHER_CALL);
2992 // Call to an arbitrary expression not handled specially above. 2987 // Call to an arbitrary expression not handled specially above.
2993 { PreservePositionScope scope(masm()->positions_recorder()); 2988 { PreservePositionScope scope(masm()->positions_recorder());
2994 VisitForStackValue(callee); 2989 VisitForStackValue(callee);
2995 } 2990 }
2996 __ PushRoot(Heap::kUndefinedValueRootIndex); 2991 __ PushRoot(Heap::kUndefinedValueRootIndex);
(...skipping 10 matching lines...) Expand all
3007 3002
3008 void FullCodeGenerator::VisitCallNew(CallNew* expr) { 3003 void FullCodeGenerator::VisitCallNew(CallNew* expr) {
3009 Comment cmnt(masm_, "[ CallNew"); 3004 Comment cmnt(masm_, "[ CallNew");
3010 // According to ECMA-262, section 11.2.2, page 44, the function 3005 // According to ECMA-262, section 11.2.2, page 44, the function
3011 // expression in new calls must be evaluated before the 3006 // expression in new calls must be evaluated before the
3012 // arguments. 3007 // arguments.
3013 3008
3014 // Push constructor on the stack. If it's not a function it's used as 3009 // Push constructor on the stack. If it's not a function it's used as
3015 // receiver for CALL_NON_FUNCTION, otherwise the value on the stack is 3010 // receiver for CALL_NON_FUNCTION, otherwise the value on the stack is
3016 // ignored. 3011 // ignored.
3017 if (expr->expression()->IsSuperReference()) { 3012 VisitForStackValue(expr->expression());
3018 EmitLoadSuperConstructor(expr->expression()->AsSuperReference());
3019 __ Push(result_register());
3020 } else {
3021 VisitForStackValue(expr->expression());
3022 }
3023 3013
3024 // Push the arguments ("left-to-right") on the stack. 3014 // Push the arguments ("left-to-right") on the stack.
3025 ZoneList<Expression*>* args = expr->arguments(); 3015 ZoneList<Expression*>* args = expr->arguments();
3026 int arg_count = args->length(); 3016 int arg_count = args->length();
3027 for (int i = 0; i < arg_count; i++) { 3017 for (int i = 0; i < arg_count; i++) {
3028 VisitForStackValue(args->at(i)); 3018 VisitForStackValue(args->at(i));
3029 } 3019 }
3030 3020
3031 // Call the construct call builtin that handles allocation and 3021 // Call the construct call builtin that handles allocation and
3032 // constructor invocation. 3022 // constructor invocation.
(...skipping 2138 matching lines...) Expand 10 before | Expand all | Expand 10 after
5171 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 5161 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
5172 Assembler::target_address_at(call_target_address, 5162 Assembler::target_address_at(call_target_address,
5173 unoptimized_code)); 5163 unoptimized_code));
5174 return OSR_AFTER_STACK_CHECK; 5164 return OSR_AFTER_STACK_CHECK;
5175 } 5165 }
5176 5166
5177 5167
5178 } } // namespace v8::internal 5168 } } // namespace v8::internal
5179 5169
5180 #endif // V8_TARGET_ARCH_X64 5170 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | test/mjsunit/harmony/super.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698