OLD | NEW |
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_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
8 | 8 |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 3361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3372 StringCharAtGenerator generator(v0, a3, a2, v0, &runtime, &runtime, &runtime, | 3372 StringCharAtGenerator generator(v0, a3, a2, v0, &runtime, &runtime, &runtime, |
3373 STRING_INDEX_IS_NUMBER, RECEIVER_IS_STRING); | 3373 STRING_INDEX_IS_NUMBER, RECEIVER_IS_STRING); |
3374 generator.GenerateFast(masm); | 3374 generator.GenerateFast(masm); |
3375 __ DropAndRet(3); | 3375 __ DropAndRet(3); |
3376 generator.SkipSlow(masm, &runtime); | 3376 generator.SkipSlow(masm, &runtime); |
3377 } | 3377 } |
3378 | 3378 |
3379 | 3379 |
3380 void ToNumberStub::Generate(MacroAssembler* masm) { | 3380 void ToNumberStub::Generate(MacroAssembler* masm) { |
3381 // The ToNumber stub takes one argument in a0. | 3381 // The ToNumber stub takes one argument in a0. |
3382 Label check_heap_number, call_builtin; | 3382 Label not_smi; |
3383 __ JumpIfNotSmi(a0, &check_heap_number); | 3383 __ JumpIfNotSmi(a0, ¬_smi); |
3384 __ Ret(USE_DELAY_SLOT); | 3384 __ Ret(USE_DELAY_SLOT); |
3385 __ mov(v0, a0); | 3385 __ mov(v0, a0); |
| 3386 __ bind(¬_smi); |
3386 | 3387 |
3387 __ bind(&check_heap_number); | 3388 Label not_heap_number; |
3388 __ ld(a1, FieldMemOperand(a0, HeapObject::kMapOffset)); | 3389 __ ld(a1, FieldMemOperand(a0, HeapObject::kMapOffset)); |
3389 __ LoadRoot(at, Heap::kHeapNumberMapRootIndex); | 3390 __ lbu(a1, FieldMemOperand(a1, Map::kInstanceTypeOffset)); |
3390 __ Branch(&call_builtin, ne, a1, Operand(at)); | 3391 // a0: object |
| 3392 // a1: instance type. |
| 3393 __ Branch(¬_heap_number, ne, a1, Operand(HEAP_NUMBER_TYPE)); |
3391 __ Ret(USE_DELAY_SLOT); | 3394 __ Ret(USE_DELAY_SLOT); |
3392 __ mov(v0, a0); | 3395 __ mov(v0, a0); |
| 3396 __ bind(¬_heap_number); |
3393 | 3397 |
3394 __ bind(&call_builtin); | 3398 Label not_string, slow_string; |
3395 __ push(a0); | 3399 __ Branch(¬_string, hs, a1, Operand(FIRST_NONSTRING_TYPE)); |
| 3400 // Check if string has a cached array index. |
| 3401 __ ld(a2, FieldMemOperand(a0, String::kHashFieldOffset)); |
| 3402 __ And(at, a2, Operand(String::kContainsCachedArrayIndexMask)); |
| 3403 __ Branch(&slow_string, ne, at, Operand(zero_reg)); |
| 3404 __ IndexFromHash(a2, a0); |
| 3405 __ Ret(USE_DELAY_SLOT); |
| 3406 __ mov(v0, a0); |
| 3407 __ bind(&slow_string); |
| 3408 __ push(a0); // Push argument. |
| 3409 __ TailCallRuntime(Runtime::kStringToNumber, 1, 1); |
| 3410 __ bind(¬_string); |
| 3411 |
| 3412 Label not_oddball; |
| 3413 __ Branch(¬_oddball, ne, a1, Operand(ODDBALL_TYPE)); |
| 3414 __ Ret(USE_DELAY_SLOT); |
| 3415 __ ld(v0, FieldMemOperand(a0, Oddball::kToNumberOffset)); |
| 3416 __ bind(¬_oddball); |
| 3417 |
| 3418 __ push(a0); // Push argument. |
3396 __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION); | 3419 __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION); |
3397 } | 3420 } |
3398 | 3421 |
3399 | 3422 |
3400 void StringHelper::GenerateFlatOneByteStringEquals( | 3423 void StringHelper::GenerateFlatOneByteStringEquals( |
3401 MacroAssembler* masm, Register left, Register right, Register scratch1, | 3424 MacroAssembler* masm, Register left, Register right, Register scratch1, |
3402 Register scratch2, Register scratch3) { | 3425 Register scratch2, Register scratch3) { |
3403 Register length = scratch1; | 3426 Register length = scratch1; |
3404 | 3427 |
3405 // Compare lengths. | 3428 // Compare lengths. |
(...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4983 MemOperand(fp, 6 * kPointerSize), | 5006 MemOperand(fp, 6 * kPointerSize), |
4984 NULL); | 5007 NULL); |
4985 } | 5008 } |
4986 | 5009 |
4987 | 5010 |
4988 #undef __ | 5011 #undef __ |
4989 | 5012 |
4990 } } // namespace v8::internal | 5013 } } // namespace v8::internal |
4991 | 5014 |
4992 #endif // V8_TARGET_ARCH_MIPS64 | 5015 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |