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

Side by Side Diff: src/builtins/mips/builtins-mips.cc

Issue 2381843002: Add Smi::Zero and replace all Smi::FromInt(0) calls (Closed)
Patch Set: Mark Smi::kZero as V8_EXPORT_PRIVATE Created 4 years, 2 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/builtins/ia32/builtins-ia32.cc ('k') | src/builtins/mips64/builtins-mips64.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 #if V8_TARGET_ARCH_MIPS 5 #if V8_TARGET_ARCH_MIPS
6 6
7 #include "src/codegen.h" 7 #include "src/codegen.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 } 259 }
260 260
261 { 261 {
262 // Drop all arguments including the receiver. 262 // Drop all arguments including the receiver.
263 __ Lsa(sp, sp, t0, kPointerSizeLog2); 263 __ Lsa(sp, sp, t0, kPointerSizeLog2);
264 __ DropAndRet(1); 264 __ DropAndRet(1);
265 } 265 }
266 266
267 // 2b. No arguments, return +0. 267 // 2b. No arguments, return +0.
268 __ bind(&no_arguments); 268 __ bind(&no_arguments);
269 __ Move(v0, Smi::FromInt(0)); 269 __ Move(v0, Smi::kZero);
270 __ DropAndRet(1); 270 __ DropAndRet(1);
271 } 271 }
272 272
273 // static 273 // static
274 void Builtins::Generate_NumberConstructor_ConstructStub(MacroAssembler* masm) { 274 void Builtins::Generate_NumberConstructor_ConstructStub(MacroAssembler* masm) {
275 // ----------- S t a t e ------------- 275 // ----------- S t a t e -------------
276 // -- a0 : number of arguments 276 // -- a0 : number of arguments
277 // -- a1 : constructor function 277 // -- a1 : constructor function
278 // -- a3 : new target 278 // -- a3 : new target
279 // -- cp : context 279 // -- cp : context
280 // -- ra : return address 280 // -- ra : return address
281 // -- sp[(argc - n - 1) * 4] : arg[n] (zero based) 281 // -- sp[(argc - n - 1) * 4] : arg[n] (zero based)
282 // -- sp[argc * 4] : receiver 282 // -- sp[argc * 4] : receiver
283 // ----------------------------------- 283 // -----------------------------------
284 284
285 // 1. Make sure we operate in the context of the called function. 285 // 1. Make sure we operate in the context of the called function.
286 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); 286 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
287 287
288 // 2. Load the first argument into a0. 288 // 2. Load the first argument into a0.
289 { 289 {
290 Label no_arguments, done; 290 Label no_arguments, done;
291 __ mov(t0, a0); // Store argc in t0. 291 __ mov(t0, a0); // Store argc in t0.
292 __ Branch(USE_DELAY_SLOT, &no_arguments, eq, a0, Operand(zero_reg)); 292 __ Branch(USE_DELAY_SLOT, &no_arguments, eq, a0, Operand(zero_reg));
293 __ Subu(t1, a0, Operand(1)); // In delay slot. 293 __ Subu(t1, a0, Operand(1)); // In delay slot.
294 __ Lsa(at, sp, t1, kPointerSizeLog2); 294 __ Lsa(at, sp, t1, kPointerSizeLog2);
295 __ lw(a0, MemOperand(at)); 295 __ lw(a0, MemOperand(at));
296 __ jmp(&done); 296 __ jmp(&done);
297 __ bind(&no_arguments); 297 __ bind(&no_arguments);
298 __ Move(a0, Smi::FromInt(0)); 298 __ Move(a0, Smi::kZero);
299 __ bind(&done); 299 __ bind(&done);
300 } 300 }
301 301
302 // 3. Make sure a0 is a number. 302 // 3. Make sure a0 is a number.
303 { 303 {
304 Label done_convert; 304 Label done_convert;
305 __ JumpIfSmi(a0, &done_convert); 305 __ JumpIfSmi(a0, &done_convert);
306 __ GetObjectType(a0, a2, a2); 306 __ GetObjectType(a0, a2, a2);
307 __ Branch(&done_convert, eq, a2, Operand(HEAP_NUMBER_TYPE)); 307 __ Branch(&done_convert, eq, a2, Operand(HEAP_NUMBER_TYPE));
308 { 308 {
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 // Unreachable code. 1318 // Unreachable code.
1319 __ break_(0xCC); 1319 __ break_(0xCC);
1320 } 1320 }
1321 } 1321 }
1322 1322
1323 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { 1323 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) {
1324 // Set the return address to the correct point in the interpreter entry 1324 // Set the return address to the correct point in the interpreter entry
1325 // trampoline. 1325 // trampoline.
1326 Smi* interpreter_entry_return_pc_offset( 1326 Smi* interpreter_entry_return_pc_offset(
1327 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); 1327 masm->isolate()->heap()->interpreter_entry_return_pc_offset());
1328 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0)); 1328 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::kZero);
1329 __ li(t0, Operand(masm->isolate()->builtins()->InterpreterEntryTrampoline())); 1329 __ li(t0, Operand(masm->isolate()->builtins()->InterpreterEntryTrampoline()));
1330 __ Addu(ra, t0, Operand(interpreter_entry_return_pc_offset->value() + 1330 __ Addu(ra, t0, Operand(interpreter_entry_return_pc_offset->value() +
1331 Code::kHeaderSize - kHeapObjectTag)); 1331 Code::kHeaderSize - kHeapObjectTag));
1332 1332
1333 // Initialize the dispatch table register. 1333 // Initialize the dispatch table register.
1334 __ li(kInterpreterDispatchTableRegister, 1334 __ li(kInterpreterDispatchTableRegister,
1335 Operand(ExternalReference::interpreter_dispatch_table_address( 1335 Operand(ExternalReference::interpreter_dispatch_table_address(
1336 masm->isolate()))); 1336 masm->isolate())));
1337 1337
1338 // Get the bytecode array pointer from the frame. 1338 // Get the bytecode array pointer from the frame.
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
1851 } 1851 }
1852 1852
1853 { 1853 {
1854 FrameScope scope(masm, StackFrame::INTERNAL); 1854 FrameScope scope(masm, StackFrame::INTERNAL);
1855 // Pass function as argument. 1855 // Pass function as argument.
1856 __ push(a0); 1856 __ push(a0);
1857 __ CallRuntime(Runtime::kCompileForOnStackReplacement); 1857 __ CallRuntime(Runtime::kCompileForOnStackReplacement);
1858 } 1858 }
1859 1859
1860 // If the code object is null, just return to the caller. 1860 // If the code object is null, just return to the caller.
1861 __ Ret(eq, v0, Operand(Smi::FromInt(0))); 1861 __ Ret(eq, v0, Operand(Smi::kZero));
1862 1862
1863 // Drop any potential handler frame that is be sitting on top of the actual 1863 // Drop any potential handler frame that is be sitting on top of the actual
1864 // JavaScript frame. This is the case then OSR is triggered from bytecode. 1864 // JavaScript frame. This is the case then OSR is triggered from bytecode.
1865 if (has_handler_frame) { 1865 if (has_handler_frame) {
1866 __ LeaveFrame(StackFrame::STUB); 1866 __ LeaveFrame(StackFrame::STUB);
1867 } 1867 }
1868 1868
1869 // Load deoptimization data from the code object. 1869 // Load deoptimization data from the code object.
1870 // <deopt_data> = <code>[#deoptimization_data_offset] 1870 // <deopt_data> = <code>[#deoptimization_data_offset]
1871 __ lw(a1, MemOperand(v0, Code::kDeoptimizationDataOffset - kHeapObjectTag)); 1871 __ lw(a1, MemOperand(v0, Code::kDeoptimizationDataOffset - kHeapObjectTag));
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
2833 } 2833 }
2834 2834
2835 // static 2835 // static
2836 void Builtins::Generate_AllocateInNewSpace(MacroAssembler* masm) { 2836 void Builtins::Generate_AllocateInNewSpace(MacroAssembler* masm) {
2837 // ----------- S t a t e ------------- 2837 // ----------- S t a t e -------------
2838 // -- a0 : requested object size (untagged) 2838 // -- a0 : requested object size (untagged)
2839 // -- ra : return address 2839 // -- ra : return address
2840 // ----------------------------------- 2840 // -----------------------------------
2841 __ SmiTag(a0); 2841 __ SmiTag(a0);
2842 __ Push(a0); 2842 __ Push(a0);
2843 __ Move(cp, Smi::FromInt(0)); 2843 __ Move(cp, Smi::kZero);
2844 __ TailCallRuntime(Runtime::kAllocateInNewSpace); 2844 __ TailCallRuntime(Runtime::kAllocateInNewSpace);
2845 } 2845 }
2846 2846
2847 // static 2847 // static
2848 void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) { 2848 void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) {
2849 // ----------- S t a t e ------------- 2849 // ----------- S t a t e -------------
2850 // -- a0 : requested object size (untagged) 2850 // -- a0 : requested object size (untagged)
2851 // -- ra : return address 2851 // -- ra : return address
2852 // ----------------------------------- 2852 // -----------------------------------
2853 __ SmiTag(a0); 2853 __ SmiTag(a0);
2854 __ Move(a1, Smi::FromInt(AllocateTargetSpace::encode(OLD_SPACE))); 2854 __ Move(a1, Smi::FromInt(AllocateTargetSpace::encode(OLD_SPACE)));
2855 __ Push(a0, a1); 2855 __ Push(a0, a1);
2856 __ Move(cp, Smi::FromInt(0)); 2856 __ Move(cp, Smi::kZero);
2857 __ TailCallRuntime(Runtime::kAllocateInTargetSpace); 2857 __ TailCallRuntime(Runtime::kAllocateInTargetSpace);
2858 } 2858 }
2859 2859
2860 // static 2860 // static
2861 void Builtins::Generate_Abort(MacroAssembler* masm) { 2861 void Builtins::Generate_Abort(MacroAssembler* masm) {
2862 // ----------- S t a t e ------------- 2862 // ----------- S t a t e -------------
2863 // -- a0 : message_id as Smi 2863 // -- a0 : message_id as Smi
2864 // -- ra : return address 2864 // -- ra : return address
2865 // ----------------------------------- 2865 // -----------------------------------
2866 __ Push(a0); 2866 __ Push(a0);
2867 __ Move(cp, Smi::FromInt(0)); 2867 __ Move(cp, Smi::kZero);
2868 __ TailCallRuntime(Runtime::kAbort); 2868 __ TailCallRuntime(Runtime::kAbort);
2869 } 2869 }
2870 2870
2871 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { 2871 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
2872 // State setup as expected by MacroAssembler::InvokePrologue. 2872 // State setup as expected by MacroAssembler::InvokePrologue.
2873 // ----------- S t a t e ------------- 2873 // ----------- S t a t e -------------
2874 // -- a0: actual arguments count 2874 // -- a0: actual arguments count
2875 // -- a1: function (passed through to callee) 2875 // -- a1: function (passed through to callee)
2876 // -- a2: expected arguments count 2876 // -- a2: expected arguments count
2877 // -- a3: new target (passed through to callee) 2877 // -- a3: new target (passed through to callee)
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
2997 __ break_(0xCC); 2997 __ break_(0xCC);
2998 } 2998 }
2999 } 2999 }
3000 3000
3001 #undef __ 3001 #undef __
3002 3002
3003 } // namespace internal 3003 } // namespace internal
3004 } // namespace v8 3004 } // namespace v8
3005 3005
3006 #endif // V8_TARGET_ARCH_MIPS 3006 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/builtins/ia32/builtins-ia32.cc ('k') | src/builtins/mips64/builtins-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698