OLD | NEW |
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_PPC | 5 #if V8_TARGET_ARCH_PPC |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1389 DCHECK(!scratch.is(LoadWithVectorDescriptor::VectorRegister()) && | 1389 DCHECK(!scratch.is(LoadWithVectorDescriptor::VectorRegister()) && |
1390 result.is(LoadWithVectorDescriptor::SlotRegister())); | 1390 result.is(LoadWithVectorDescriptor::SlotRegister())); |
1391 | 1391 |
1392 // StringCharAtGenerator doesn't use the result register until it's passed | 1392 // StringCharAtGenerator doesn't use the result register until it's passed |
1393 // the different miss possibilities. If it did, we would have a conflict | 1393 // the different miss possibilities. If it did, we would have a conflict |
1394 // when FLAG_vector_ics is true. | 1394 // when FLAG_vector_ics is true. |
1395 StringCharAtGenerator char_at_generator(receiver, index, scratch, result, | 1395 StringCharAtGenerator char_at_generator(receiver, index, scratch, result, |
1396 &miss, // When not a string. | 1396 &miss, // When not a string. |
1397 &miss, // When not a number. | 1397 &miss, // When not a number. |
1398 &miss, // When index out of range. | 1398 &miss, // When index out of range. |
1399 STRING_INDEX_IS_ARRAY_INDEX, | |
1400 RECEIVER_IS_STRING); | 1399 RECEIVER_IS_STRING); |
1401 char_at_generator.GenerateFast(masm); | 1400 char_at_generator.GenerateFast(masm); |
1402 __ Ret(); | 1401 __ Ret(); |
1403 | 1402 |
1404 StubRuntimeCallHelper call_helper; | 1403 StubRuntimeCallHelper call_helper; |
1405 char_at_generator.GenerateSlow(masm, PART_OF_IC_HANDLER, call_helper); | 1404 char_at_generator.GenerateSlow(masm, PART_OF_IC_HANDLER, call_helper); |
1406 | 1405 |
1407 __ bind(&miss); | 1406 __ bind(&miss); |
1408 PropertyAccessCompiler::TailCallBuiltin( | 1407 PropertyAccessCompiler::TailCallBuiltin( |
1409 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); | 1408 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); |
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2221 __ CheckMap(index_, result_, Heap::kHeapNumberMapRootIndex, index_not_number_, | 2220 __ CheckMap(index_, result_, Heap::kHeapNumberMapRootIndex, index_not_number_, |
2222 DONT_DO_SMI_CHECK); | 2221 DONT_DO_SMI_CHECK); |
2223 call_helper.BeforeCall(masm); | 2222 call_helper.BeforeCall(masm); |
2224 if (embed_mode == PART_OF_IC_HANDLER) { | 2223 if (embed_mode == PART_OF_IC_HANDLER) { |
2225 __ Push(LoadWithVectorDescriptor::VectorRegister(), | 2224 __ Push(LoadWithVectorDescriptor::VectorRegister(), |
2226 LoadWithVectorDescriptor::SlotRegister(), object_, index_); | 2225 LoadWithVectorDescriptor::SlotRegister(), object_, index_); |
2227 } else { | 2226 } else { |
2228 // index_ is consumed by runtime conversion function. | 2227 // index_ is consumed by runtime conversion function. |
2229 __ Push(object_, index_); | 2228 __ Push(object_, index_); |
2230 } | 2229 } |
2231 if (index_flags_ == STRING_INDEX_IS_NUMBER) { | 2230 __ CallRuntime(Runtime::kNumberToSmi); |
2232 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero); | |
2233 } else { | |
2234 DCHECK(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); | |
2235 // NumberToSmi discards numbers that are not exact integers. | |
2236 __ CallRuntime(Runtime::kNumberToSmi); | |
2237 } | |
2238 // Save the conversion result before the pop instructions below | 2231 // Save the conversion result before the pop instructions below |
2239 // have a chance to overwrite it. | 2232 // have a chance to overwrite it. |
2240 __ Move(index_, r3); | 2233 __ Move(index_, r3); |
2241 if (embed_mode == PART_OF_IC_HANDLER) { | 2234 if (embed_mode == PART_OF_IC_HANDLER) { |
2242 __ Pop(LoadWithVectorDescriptor::VectorRegister(), | 2235 __ Pop(LoadWithVectorDescriptor::VectorRegister(), |
2243 LoadWithVectorDescriptor::SlotRegister(), object_); | 2236 LoadWithVectorDescriptor::SlotRegister(), object_); |
2244 } else { | 2237 } else { |
2245 __ pop(object_); | 2238 __ pop(object_); |
2246 } | 2239 } |
2247 // Reload the instance type. | 2240 // Reload the instance type. |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2556 __ bind(&runtime); | 2549 __ bind(&runtime); |
2557 __ TailCallRuntime(Runtime::kSubString); | 2550 __ TailCallRuntime(Runtime::kSubString); |
2558 | 2551 |
2559 __ bind(&single_char); | 2552 __ bind(&single_char); |
2560 // r3: original string | 2553 // r3: original string |
2561 // r4: instance type | 2554 // r4: instance type |
2562 // r5: length | 2555 // r5: length |
2563 // r6: from index (untagged) | 2556 // r6: from index (untagged) |
2564 __ SmiTag(r6, r6); | 2557 __ SmiTag(r6, r6); |
2565 StringCharAtGenerator generator(r3, r6, r5, r3, &runtime, &runtime, &runtime, | 2558 StringCharAtGenerator generator(r3, r6, r5, r3, &runtime, &runtime, &runtime, |
2566 STRING_INDEX_IS_NUMBER, RECEIVER_IS_STRING); | 2559 RECEIVER_IS_STRING); |
2567 generator.GenerateFast(masm); | 2560 generator.GenerateFast(masm); |
2568 __ Drop(3); | 2561 __ Drop(3); |
2569 __ Ret(); | 2562 __ Ret(); |
2570 generator.SkipSlow(masm, &runtime); | 2563 generator.SkipSlow(masm, &runtime); |
2571 } | 2564 } |
2572 | 2565 |
2573 | 2566 |
2574 void ToNumberStub::Generate(MacroAssembler* masm) { | 2567 void ToNumberStub::Generate(MacroAssembler* masm) { |
2575 // The ToNumber stub takes one argument in r3. | 2568 // The ToNumber stub takes one argument in r3. |
2576 STATIC_ASSERT(kSmiTag == 0); | 2569 STATIC_ASSERT(kSmiTag == 0); |
(...skipping 3117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5694 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); | 5687 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); |
5695 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5688 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
5696 kStackUnwindSpace, NULL, return_value_operand, NULL); | 5689 kStackUnwindSpace, NULL, return_value_operand, NULL); |
5697 } | 5690 } |
5698 | 5691 |
5699 #undef __ | 5692 #undef __ |
5700 } // namespace internal | 5693 } // namespace internal |
5701 } // namespace v8 | 5694 } // namespace v8 |
5702 | 5695 |
5703 #endif // V8_TARGET_ARCH_PPC | 5696 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |