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_X87 | 7 #if V8_TARGET_ARCH_X87 |
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 2490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2501 __ ret((HasArgsInRegisters() ? 0 : 2) * kPointerSize); | 2501 __ ret((HasArgsInRegisters() ? 0 : 2) * kPointerSize); |
2502 } | 2502 } |
2503 } | 2503 } |
2504 | 2504 |
2505 | 2505 |
2506 // ------------------------------------------------------------------------- | 2506 // ------------------------------------------------------------------------- |
2507 // StringCharCodeAtGenerator | 2507 // StringCharCodeAtGenerator |
2508 | 2508 |
2509 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { | 2509 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { |
2510 // If the receiver is a smi trigger the non-string case. | 2510 // If the receiver is a smi trigger the non-string case. |
2511 STATIC_ASSERT(kSmiTag == 0); | 2511 if (check_mode_ == RECEIVER_IS_UNKNOWN) { |
2512 __ JumpIfSmi(object_, receiver_not_string_); | 2512 __ JumpIfSmi(object_, receiver_not_string_); |
2513 | 2513 |
2514 // Fetch the instance type of the receiver into result register. | 2514 // Fetch the instance type of the receiver into result register. |
2515 __ mov(result_, FieldOperand(object_, HeapObject::kMapOffset)); | 2515 __ mov(result_, FieldOperand(object_, HeapObject::kMapOffset)); |
2516 __ movzx_b(result_, FieldOperand(result_, Map::kInstanceTypeOffset)); | 2516 __ movzx_b(result_, FieldOperand(result_, Map::kInstanceTypeOffset)); |
2517 // If the receiver is not a string trigger the non-string case. | 2517 // If the receiver is not a string trigger the non-string case. |
2518 __ test(result_, Immediate(kIsNotStringMask)); | 2518 __ test(result_, Immediate(kIsNotStringMask)); |
2519 __ j(not_zero, receiver_not_string_); | 2519 __ j(not_zero, receiver_not_string_); |
| 2520 } |
2520 | 2521 |
2521 // If the index is non-smi trigger the non-smi case. | 2522 // If the index is non-smi trigger the non-smi case. |
2522 STATIC_ASSERT(kSmiTag == 0); | |
2523 __ JumpIfNotSmi(index_, &index_not_smi_); | 2523 __ JumpIfNotSmi(index_, &index_not_smi_); |
2524 __ bind(&got_smi_index_); | 2524 __ bind(&got_smi_index_); |
2525 | 2525 |
2526 // Check for index out of range. | 2526 // Check for index out of range. |
2527 __ cmp(index_, FieldOperand(object_, String::kLengthOffset)); | 2527 __ cmp(index_, FieldOperand(object_, String::kLengthOffset)); |
2528 __ j(above_equal, index_out_of_range_); | 2528 __ j(above_equal, index_out_of_range_); |
2529 | 2529 |
2530 __ SmiUntag(index_); | 2530 __ SmiUntag(index_); |
2531 | 2531 |
2532 Factory* factory = masm->isolate()->factory(); | 2532 Factory* factory = masm->isolate()->factory(); |
(...skipping 1921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4454 Operand(ebp, 7 * kPointerSize), | 4454 Operand(ebp, 7 * kPointerSize), |
4455 NULL); | 4455 NULL); |
4456 } | 4456 } |
4457 | 4457 |
4458 | 4458 |
4459 #undef __ | 4459 #undef __ |
4460 | 4460 |
4461 } } // namespace v8::internal | 4461 } } // namespace v8::internal |
4462 | 4462 |
4463 #endif // V8_TARGET_ARCH_X87 | 4463 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |