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

Side by Side Diff: src/ic/x64/handler-compiler-x64.cc

Issue 1407313004: Adds the possibility of setting a Code object as the callback of a FunctionTemplate. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 #if V8_TARGET_ARCH_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/ic/call-optimization.h" 7 #include "src/ic/call-optimization.h"
8 #include "src/ic/handler-compiler.h" 8 #include "src/ic/handler-compiler.h"
9 #include "src/ic/ic.h" 9 #include "src/ic/ic.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 if (api_call_info->data()->IsUndefined()) { 181 if (api_call_info->data()->IsUndefined()) {
182 call_data_undefined = true; 182 call_data_undefined = true;
183 __ LoadRoot(data, Heap::kUndefinedValueRootIndex); 183 __ LoadRoot(data, Heap::kUndefinedValueRootIndex);
184 } else { 184 } else {
185 __ movp(data, FieldOperand(callee, JSFunction::kSharedFunctionInfoOffset)); 185 __ movp(data, FieldOperand(callee, JSFunction::kSharedFunctionInfoOffset));
186 __ movp(data, FieldOperand(data, SharedFunctionInfo::kFunctionDataOffset)); 186 __ movp(data, FieldOperand(data, SharedFunctionInfo::kFunctionDataOffset));
187 __ movp(data, FieldOperand(data, FunctionTemplateInfo::kCallCodeOffset)); 187 __ movp(data, FieldOperand(data, FunctionTemplateInfo::kCallCodeOffset));
188 __ movp(data, FieldOperand(data, CallHandlerInfo::kDataOffset)); 188 __ movp(data, FieldOperand(data, CallHandlerInfo::kDataOffset));
189 } 189 }
190 190
191 if (api_call_info->callback()->IsCode()) {
192 // Just tail call into the code.
193 __ Move(rdx, handle(Code::cast(api_call_info->callback())));
Benedikt Meurer 2015/11/12 04:31:21 You should be able to use __ Jump(code, RelocInfo:
epertoso 2015/11/13 01:39:28 Done.
194 __ addp(rdx, Immediate(Code::kHeaderSize - kHeapObjectTag));
195 __ jmp(rdx);
196 return;
197 }
198
191 // Put api_function_address in place. 199 // Put api_function_address in place.
192 Address function_address = v8::ToCData<Address>(api_call_info->callback()); 200 Address function_address = v8::ToCData<Address>(api_call_info->callback());
193 __ Move(api_function_address, function_address, 201 __ Move(api_function_address, function_address,
194 RelocInfo::EXTERNAL_REFERENCE); 202 RelocInfo::EXTERNAL_REFERENCE);
195 203
196 // Jump to stub. 204 // Jump to stub.
197 CallApiAccessorStub stub(isolate, is_store, call_data_undefined); 205 CallApiAccessorStub stub(isolate, is_store, call_data_undefined);
198 __ TailCallStub(&stub); 206 __ TailCallStub(&stub);
199 } 207 }
200 208
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 // Return the generated code. 819 // Return the generated code.
812 return GetCode(kind(), Code::NORMAL, name); 820 return GetCode(kind(), Code::NORMAL, name);
813 } 821 }
814 822
815 823
816 #undef __ 824 #undef __
817 } // namespace internal 825 } // namespace internal
818 } // namespace v8 826 } // namespace v8
819 827
820 #endif // V8_TARGET_ARCH_X64 828 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698