OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 3467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3478 __ jmp(&done); | 3478 __ jmp(&done); |
3479 } | 3479 } |
3480 | 3480 |
3481 __ bind(¬_date_object); | 3481 __ bind(¬_date_object); |
3482 __ CallRuntime(Runtime::kThrowNotDateError, 0); | 3482 __ CallRuntime(Runtime::kThrowNotDateError, 0); |
3483 __ bind(&done); | 3483 __ bind(&done); |
3484 context()->Plug(r0); | 3484 context()->Plug(r0); |
3485 } | 3485 } |
3486 | 3486 |
3487 | 3487 |
3488 void FullCodeGenerator::EmitSeqStringSetCharCheck(Register string, | |
3489 Register index, | |
3490 Register value, | |
3491 uint32_t encoding_mask) { | |
3492 __ SmiTst(index); | |
3493 __ Check(eq, kNonSmiIndex); | |
3494 __ SmiTst(value); | |
3495 __ Check(eq, kNonSmiValue); | |
3496 | |
3497 __ ldr(ip, FieldMemOperand(string, String::kLengthOffset)); | |
3498 __ cmp(index, ip); | |
3499 __ Check(lt, kIndexIsTooLarge); | |
3500 | |
3501 __ cmp(index, Operand(Smi::FromInt(0))); | |
3502 __ Check(ge, kIndexIsNegative); | |
3503 | |
3504 __ ldr(ip, FieldMemOperand(string, HeapObject::kMapOffset)); | |
3505 __ ldrb(ip, FieldMemOperand(ip, Map::kInstanceTypeOffset)); | |
3506 | |
3507 __ and_(ip, ip, Operand(kStringRepresentationMask | kStringEncodingMask)); | |
3508 __ cmp(ip, Operand(encoding_mask)); | |
3509 __ Check(eq, kUnexpectedStringType); | |
3510 } | |
3511 | |
3512 | |
3513 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { | 3488 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { |
3514 ZoneList<Expression*>* args = expr->arguments(); | 3489 ZoneList<Expression*>* args = expr->arguments(); |
3515 ASSERT_EQ(3, args->length()); | 3490 ASSERT_EQ(3, args->length()); |
3516 | 3491 |
3517 Register string = r0; | 3492 Register string = r0; |
3518 Register index = r1; | 3493 Register index = r1; |
3519 Register value = r2; | 3494 Register value = r2; |
3520 | 3495 |
3521 VisitForStackValue(args->at(1)); // index | 3496 VisitForStackValue(args->at(1)); // index |
3522 VisitForStackValue(args->at(2)); // value | 3497 VisitForStackValue(args->at(2)); // value |
3523 __ Pop(index, value); | 3498 __ Pop(index, value); |
3524 VisitForAccumulatorValue(args->at(0)); // string | 3499 VisitForAccumulatorValue(args->at(0)); // string |
3525 | 3500 |
3526 if (FLAG_debug_code) { | 3501 if (FLAG_debug_code) { |
3527 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; | 3502 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; |
3528 EmitSeqStringSetCharCheck(string, index, value, one_byte_seq_type); | 3503 __ EmitSeqStringSetCharCheck(string, index, value, one_byte_seq_type); |
3529 } | 3504 } |
3530 | 3505 |
3531 __ SmiUntag(value, value); | 3506 __ SmiUntag(value, value); |
3532 __ add(ip, | 3507 __ add(ip, |
3533 string, | 3508 string, |
3534 Operand(SeqOneByteString::kHeaderSize - kHeapObjectTag)); | 3509 Operand(SeqOneByteString::kHeaderSize - kHeapObjectTag)); |
3535 __ strb(value, MemOperand(ip, index, LSR, kSmiTagSize)); | 3510 __ strb(value, MemOperand(ip, index, LSR, kSmiTagSize)); |
3536 context()->Plug(string); | 3511 context()->Plug(string); |
3537 } | 3512 } |
3538 | 3513 |
3539 | 3514 |
3540 void FullCodeGenerator::EmitTwoByteSeqStringSetChar(CallRuntime* expr) { | 3515 void FullCodeGenerator::EmitTwoByteSeqStringSetChar(CallRuntime* expr) { |
3541 ZoneList<Expression*>* args = expr->arguments(); | 3516 ZoneList<Expression*>* args = expr->arguments(); |
3542 ASSERT_EQ(3, args->length()); | 3517 ASSERT_EQ(3, args->length()); |
3543 | 3518 |
3544 Register string = r0; | 3519 Register string = r0; |
3545 Register index = r1; | 3520 Register index = r1; |
3546 Register value = r2; | 3521 Register value = r2; |
3547 | 3522 |
3548 VisitForStackValue(args->at(1)); // index | 3523 VisitForStackValue(args->at(1)); // index |
3549 VisitForStackValue(args->at(2)); // value | 3524 VisitForStackValue(args->at(2)); // value |
3550 __ Pop(index, value); | 3525 __ Pop(index, value); |
3551 VisitForAccumulatorValue(args->at(0)); // string | 3526 VisitForAccumulatorValue(args->at(0)); // string |
3552 | 3527 |
3553 if (FLAG_debug_code) { | 3528 if (FLAG_debug_code) { |
3554 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; | 3529 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; |
3555 EmitSeqStringSetCharCheck(string, index, value, two_byte_seq_type); | 3530 __ EmitSeqStringSetCharCheck(string, index, value, two_byte_seq_type); |
3556 } | 3531 } |
3557 | 3532 |
3558 __ SmiUntag(value, value); | 3533 __ SmiUntag(value, value); |
3559 __ add(ip, | 3534 __ add(ip, |
3560 string, | 3535 string, |
3561 Operand(SeqTwoByteString::kHeaderSize - kHeapObjectTag)); | 3536 Operand(SeqTwoByteString::kHeaderSize - kHeapObjectTag)); |
3562 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0); | 3537 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0); |
3563 __ strh(value, MemOperand(ip, index)); | 3538 __ strh(value, MemOperand(ip, index)); |
3564 context()->Plug(string); | 3539 context()->Plug(string); |
3565 } | 3540 } |
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4978 ASSERT(Memory::uint32_at(interrupt_address_pointer) == | 4953 ASSERT(Memory::uint32_at(interrupt_address_pointer) == |
4979 reinterpret_cast<uint32_t>( | 4954 reinterpret_cast<uint32_t>( |
4980 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4955 isolate->builtins()->OsrAfterStackCheck()->entry())); |
4981 return OSR_AFTER_STACK_CHECK; | 4956 return OSR_AFTER_STACK_CHECK; |
4982 } | 4957 } |
4983 | 4958 |
4984 | 4959 |
4985 } } // namespace v8::internal | 4960 } } // namespace v8::internal |
4986 | 4961 |
4987 #endif // V8_TARGET_ARCH_ARM | 4962 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |