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

Side by Side Diff: src/ia32/code-stubs-ia32.cc

Issue 1316943002: Move (uppercase) JS builtins from js builtins object to native context. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: remove Isolate::js_builtins_object Created 5 years, 3 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/ia32/builtins-ia32.cc ('k') | src/ia32/macro-assembler-ia32.h » ('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 #if V8_TARGET_ARCH_IA32 5 #if V8_TARGET_ARCH_IA32
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 1878 matching lines...) Expand 10 before | Expand all | Expand 10 after
1889 // Push arguments below the return address. 1889 // Push arguments below the return address.
1890 __ pop(ecx); 1890 __ pop(ecx);
1891 __ push(edx); 1891 __ push(edx);
1892 __ push(eax); 1892 __ push(eax);
1893 1893
1894 // Figure out which native to call and setup the arguments. 1894 // Figure out which native to call and setup the arguments.
1895 if (cc == equal && strict()) { 1895 if (cc == equal && strict()) {
1896 __ push(ecx); 1896 __ push(ecx);
1897 __ TailCallRuntime(Runtime::kStrictEquals, 2, 1); 1897 __ TailCallRuntime(Runtime::kStrictEquals, 2, 1);
1898 } else { 1898 } else {
1899 Builtins::JavaScript builtin; 1899 int native_context_index;
1900 if (cc == equal) { 1900 if (cc == equal) {
1901 builtin = Builtins::EQUALS; 1901 native_context_index = Context::EQUALS_BUILTIN_INDEX;
1902 } else { 1902 } else {
1903 builtin = 1903 native_context_index = is_strong(strength())
1904 is_strong(strength()) ? Builtins::COMPARE_STRONG : Builtins::COMPARE; 1904 ? Context::COMPARE_STRONG_BUILTIN_INDEX
1905 : Context::COMPARE_BUILTIN_INDEX;
1905 __ push(Immediate(Smi::FromInt(NegativeComparisonResult(cc)))); 1906 __ push(Immediate(Smi::FromInt(NegativeComparisonResult(cc))));
1906 } 1907 }
1907 1908
1908 // Restore return address on the stack. 1909 // Restore return address on the stack.
1909 __ push(ecx); 1910 __ push(ecx);
1910 1911
1911 // Call the native; it returns -1 (less), 0 (equal), or 1 (greater) 1912 // Call the native; it returns -1 (less), 0 (equal), or 1 (greater)
1912 // tagged as a small integer. 1913 // tagged as a small integer.
1913 __ InvokeBuiltin(builtin, JUMP_FUNCTION); 1914 __ InvokeBuiltin(native_context_index, JUMP_FUNCTION);
1914 } 1915 }
1915 1916
1916 __ bind(&miss); 1917 __ bind(&miss);
1917 GenerateMiss(masm); 1918 GenerateMiss(masm);
1918 } 1919 }
1919 1920
1920 1921
1921 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub, 1922 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub,
1922 bool is_super) { 1923 bool is_super) {
1923 // eax : number of arguments to the construct function 1924 // eax : number of arguments to the construct function
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
2068 int argc, 2069 int argc,
2069 Label* non_function) { 2070 Label* non_function) {
2070 // Check for function proxy. 2071 // Check for function proxy.
2071 __ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE); 2072 __ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE);
2072 __ j(not_equal, non_function); 2073 __ j(not_equal, non_function);
2073 __ pop(ecx); 2074 __ pop(ecx);
2074 __ push(edi); // put proxy as additional argument under return address 2075 __ push(edi); // put proxy as additional argument under return address
2075 __ push(ecx); 2076 __ push(ecx);
2076 __ Move(eax, Immediate(argc + 1)); 2077 __ Move(eax, Immediate(argc + 1));
2077 __ Move(ebx, Immediate(0)); 2078 __ Move(ebx, Immediate(0));
2078 __ GetBuiltinEntry(edx, Builtins::CALL_FUNCTION_PROXY); 2079 __ GetBuiltinEntry(edx, Context::CALL_FUNCTION_PROXY_BUILTIN_INDEX);
2079 { 2080 {
2080 Handle<Code> adaptor = isolate->builtins()->ArgumentsAdaptorTrampoline(); 2081 Handle<Code> adaptor = isolate->builtins()->ArgumentsAdaptorTrampoline();
2081 __ jmp(adaptor, RelocInfo::CODE_TARGET); 2082 __ jmp(adaptor, RelocInfo::CODE_TARGET);
2082 } 2083 }
2083 2084
2084 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead 2085 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead
2085 // of the original receiver from the call site). 2086 // of the original receiver from the call site).
2086 __ bind(non_function); 2087 __ bind(non_function);
2087 __ mov(Operand(esp, (argc + 1) * kPointerSize), edi); 2088 __ mov(Operand(esp, (argc + 1) * kPointerSize), edi);
2088 __ Move(eax, Immediate(argc)); 2089 __ Move(eax, Immediate(argc));
2089 __ Move(ebx, Immediate(0)); 2090 __ Move(ebx, Immediate(0));
2090 __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION); 2091 __ GetBuiltinEntry(edx, Context::CALL_NON_FUNCTION_BUILTIN_INDEX);
2091 Handle<Code> adaptor = isolate->builtins()->ArgumentsAdaptorTrampoline(); 2092 Handle<Code> adaptor = isolate->builtins()->ArgumentsAdaptorTrampoline();
2092 __ jmp(adaptor, RelocInfo::CODE_TARGET); 2093 __ jmp(adaptor, RelocInfo::CODE_TARGET);
2093 } 2094 }
2094 2095
2095 2096
2096 static void EmitWrapCase(MacroAssembler* masm, int argc, Label* cont) { 2097 static void EmitWrapCase(MacroAssembler* masm, int argc, Label* cont) {
2097 // Wrap the receiver and patch it back onto the stack. 2098 // Wrap the receiver and patch it back onto the stack.
2098 { FrameScope frame_scope(masm, StackFrame::INTERNAL); 2099 { FrameScope frame_scope(masm, StackFrame::INTERNAL);
2099 __ push(edi); 2100 __ push(edi);
2100 ToObjectStub stub(masm->isolate()); 2101 ToObjectStub stub(masm->isolate());
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
2224 __ jmp(jmp_reg); 2225 __ jmp(jmp_reg);
2225 2226
2226 // edi: called object 2227 // edi: called object
2227 // eax: number of arguments 2228 // eax: number of arguments
2228 // ecx: object map 2229 // ecx: object map
2229 // esp[0]: original receiver (for IsSuperConstructorCall) 2230 // esp[0]: original receiver (for IsSuperConstructorCall)
2230 Label do_call; 2231 Label do_call;
2231 __ bind(&slow); 2232 __ bind(&slow);
2232 __ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE); 2233 __ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE);
2233 __ j(not_equal, &non_function_call); 2234 __ j(not_equal, &non_function_call);
2234 __ GetBuiltinEntry(edx, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR); 2235 __ GetBuiltinEntry(edx,
2236 Context::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR_BUILTIN_INDEX);
2235 __ jmp(&do_call); 2237 __ jmp(&do_call);
2236 2238
2237 __ bind(&non_function_call); 2239 __ bind(&non_function_call);
2238 __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); 2240 __ GetBuiltinEntry(edx,
2241 Context::CALL_NON_FUNCTION_AS_CONSTRUCTOR_BUILTIN_INDEX);
2239 __ bind(&do_call); 2242 __ bind(&do_call);
2240 if (IsSuperConstructorCall()) { 2243 if (IsSuperConstructorCall()) {
2241 __ Drop(1); 2244 __ Drop(1);
2242 } 2245 }
2243 // Set expected number of arguments to zero (not changing eax). 2246 // Set expected number of arguments to zero (not changing eax).
2244 __ Move(ebx, Immediate(0)); 2247 __ Move(ebx, Immediate(0));
2245 Handle<Code> arguments_adaptor = 2248 Handle<Code> arguments_adaptor =
2246 isolate()->builtins()->ArgumentsAdaptorTrampoline(); 2249 isolate()->builtins()->ArgumentsAdaptorTrampoline();
2247 __ jmp(arguments_adaptor, RelocInfo::CODE_TARGET); 2250 __ jmp(arguments_adaptor, RelocInfo::CODE_TARGET);
2248 } 2251 }
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after
3261 Label not_oddball; 3264 Label not_oddball;
3262 __ CmpInstanceType(edi, ODDBALL_TYPE); 3265 __ CmpInstanceType(edi, ODDBALL_TYPE);
3263 __ j(not_equal, &not_oddball, Label::kNear); 3266 __ j(not_equal, &not_oddball, Label::kNear);
3264 __ mov(eax, FieldOperand(eax, Oddball::kToNumberOffset)); 3267 __ mov(eax, FieldOperand(eax, Oddball::kToNumberOffset));
3265 __ Ret(); 3268 __ Ret();
3266 __ bind(&not_oddball); 3269 __ bind(&not_oddball);
3267 3270
3268 __ pop(ecx); // Pop return address. 3271 __ pop(ecx); // Pop return address.
3269 __ push(eax); // Push argument. 3272 __ push(eax); // Push argument.
3270 __ push(ecx); // Push return address. 3273 __ push(ecx); // Push return address.
3271 __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION); 3274 __ InvokeBuiltin(Context::TO_NUMBER_BUILTIN_INDEX, JUMP_FUNCTION);
3272 } 3275 }
3273 3276
3274 3277
3275 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, 3278 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm,
3276 Register left, 3279 Register left,
3277 Register right, 3280 Register right,
3278 Register scratch1, 3281 Register scratch1,
3279 Register scratch2) { 3282 Register scratch2) {
3280 Register length = scratch1; 3283 Register length = scratch1;
3281 3284
(...skipping 2251 matching lines...) Expand 10 before | Expand all | Expand 10 after
5533 Operand(ebp, 7 * kPointerSize), NULL); 5536 Operand(ebp, 7 * kPointerSize), NULL);
5534 } 5537 }
5535 5538
5536 5539
5537 #undef __ 5540 #undef __
5538 5541
5539 } // namespace internal 5542 } // namespace internal
5540 } // namespace v8 5543 } // namespace v8
5541 5544
5542 #endif // V8_TARGET_ARCH_IA32 5545 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/builtins-ia32.cc ('k') | src/ia32/macro-assembler-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698