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_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 3322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3333 StringCharAtGenerator generator(v0, a3, a2, v0, &runtime, &runtime, &runtime, | 3333 StringCharAtGenerator generator(v0, a3, a2, v0, &runtime, &runtime, &runtime, |
3334 STRING_INDEX_IS_NUMBER, RECEIVER_IS_STRING); | 3334 STRING_INDEX_IS_NUMBER, RECEIVER_IS_STRING); |
3335 generator.GenerateFast(masm); | 3335 generator.GenerateFast(masm); |
3336 __ DropAndRet(3); | 3336 __ DropAndRet(3); |
3337 generator.SkipSlow(masm, &runtime); | 3337 generator.SkipSlow(masm, &runtime); |
3338 } | 3338 } |
3339 | 3339 |
3340 | 3340 |
3341 void ToNumberStub::Generate(MacroAssembler* masm) { | 3341 void ToNumberStub::Generate(MacroAssembler* masm) { |
3342 // The ToNumber stub takes one argument in a0. | 3342 // The ToNumber stub takes one argument in a0. |
3343 Label check_heap_number, call_builtin; | 3343 Label not_smi; |
3344 __ JumpIfNotSmi(a0, &check_heap_number); | 3344 __ JumpIfNotSmi(a0, ¬_smi); |
3345 __ Ret(USE_DELAY_SLOT); | 3345 __ Ret(USE_DELAY_SLOT); |
3346 __ mov(v0, a0); | 3346 __ mov(v0, a0); |
| 3347 __ bind(¬_smi); |
3347 | 3348 |
3348 __ bind(&check_heap_number); | 3349 Label not_heap_number; |
3349 __ lw(a1, FieldMemOperand(a0, HeapObject::kMapOffset)); | 3350 __ lw(a1, FieldMemOperand(a0, HeapObject::kMapOffset)); |
3350 __ LoadRoot(at, Heap::kHeapNumberMapRootIndex); | 3351 __ lbu(a1, FieldMemOperand(a1, Map::kInstanceTypeOffset)); |
3351 __ Branch(&call_builtin, ne, a1, Operand(at)); | 3352 // a0: object |
| 3353 // a1: instance type. |
| 3354 __ Branch(¬_heap_number, ne, a1, Operand(HEAP_NUMBER_TYPE)); |
3352 __ Ret(USE_DELAY_SLOT); | 3355 __ Ret(USE_DELAY_SLOT); |
3353 __ mov(v0, a0); | 3356 __ mov(v0, a0); |
| 3357 __ bind(¬_heap_number); |
3354 | 3358 |
3355 __ bind(&call_builtin); | 3359 Label not_string, slow_string; |
3356 __ push(a0); | 3360 __ Branch(¬_string, hs, a1, Operand(FIRST_NONSTRING_TYPE)); |
| 3361 // Check if string has a cached array index. |
| 3362 __ lw(a2, FieldMemOperand(a0, String::kHashFieldOffset)); |
| 3363 __ And(at, a2, Operand(String::kContainsCachedArrayIndexMask)); |
| 3364 __ Branch(&slow_string, ne, at, Operand(zero_reg)); |
| 3365 __ IndexFromHash(a2, a0); |
| 3366 __ Ret(USE_DELAY_SLOT); |
| 3367 __ mov(v0, a0); |
| 3368 __ bind(&slow_string); |
| 3369 __ push(a0); // Push argument. |
| 3370 __ TailCallRuntime(Runtime::kStringToNumber, 1, 1); |
| 3371 __ bind(¬_string); |
| 3372 |
| 3373 Label not_oddball; |
| 3374 __ Branch(¬_oddball, ne, a1, Operand(ODDBALL_TYPE)); |
| 3375 __ Ret(USE_DELAY_SLOT); |
| 3376 __ lw(v0, FieldMemOperand(a0, Oddball::kToNumberOffset)); |
| 3377 __ bind(¬_oddball); |
| 3378 |
| 3379 __ push(a0); // Push argument. |
3357 __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION); | 3380 __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION); |
3358 } | 3381 } |
3359 | 3382 |
3360 | 3383 |
3361 void StringHelper::GenerateFlatOneByteStringEquals( | 3384 void StringHelper::GenerateFlatOneByteStringEquals( |
3362 MacroAssembler* masm, Register left, Register right, Register scratch1, | 3385 MacroAssembler* masm, Register left, Register right, Register scratch1, |
3363 Register scratch2, Register scratch3) { | 3386 Register scratch2, Register scratch3) { |
3364 Register length = scratch1; | 3387 Register length = scratch1; |
3365 | 3388 |
3366 // Compare lengths. | 3389 // Compare lengths. |
(...skipping 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4943 MemOperand(fp, 6 * kPointerSize), | 4966 MemOperand(fp, 6 * kPointerSize), |
4944 NULL); | 4967 NULL); |
4945 } | 4968 } |
4946 | 4969 |
4947 | 4970 |
4948 #undef __ | 4971 #undef __ |
4949 | 4972 |
4950 } } // namespace v8::internal | 4973 } } // namespace v8::internal |
4951 | 4974 |
4952 #endif // V8_TARGET_ARCH_MIPS | 4975 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |