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 3407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3418 __ jmp(&done); | 3418 __ jmp(&done); |
3419 } | 3419 } |
3420 | 3420 |
3421 __ bind(¬_date_object); | 3421 __ bind(¬_date_object); |
3422 __ CallRuntime(Runtime::kThrowNotDateError, 0); | 3422 __ CallRuntime(Runtime::kThrowNotDateError, 0); |
3423 __ bind(&done); | 3423 __ bind(&done); |
3424 context()->Plug(r0); | 3424 context()->Plug(r0); |
3425 } | 3425 } |
3426 | 3426 |
3427 | 3427 |
| 3428 void FullCodeGenerator::EmitSeqStringSetCharCheck(Register string, |
| 3429 Register index, |
| 3430 Register value, |
| 3431 uint32_t encoding_mask) { |
| 3432 __ SmiTst(index); |
| 3433 __ Check(eq, "Non-smi index"); |
| 3434 __ SmiTst(value); |
| 3435 __ Check(eq, "Non-smi value"); |
| 3436 |
| 3437 __ ldr(ip, FieldMemOperand(string, String::kLengthOffset)); |
| 3438 __ cmp(index, ip); |
| 3439 __ Check(lt, "Index is too large"); |
| 3440 |
| 3441 __ cmp(index, Operand(Smi::FromInt(0))); |
| 3442 __ Check(ge, "Index is negative"); |
| 3443 |
| 3444 __ ldr(ip, FieldMemOperand(string, HeapObject::kMapOffset)); |
| 3445 __ ldrb(ip, FieldMemOperand(ip, Map::kInstanceTypeOffset)); |
| 3446 |
| 3447 __ and_(ip, ip, Operand(kStringRepresentationMask | kStringEncodingMask)); |
| 3448 __ cmp(ip, Operand(encoding_mask)); |
| 3449 __ Check(eq, "Unexpected string type"); |
| 3450 } |
| 3451 |
| 3452 |
3428 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { | 3453 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { |
3429 ZoneList<Expression*>* args = expr->arguments(); | 3454 ZoneList<Expression*>* args = expr->arguments(); |
3430 ASSERT_EQ(3, args->length()); | 3455 ASSERT_EQ(3, args->length()); |
3431 | 3456 |
| 3457 Register string = r0; |
| 3458 Register index = r1; |
| 3459 Register value = r2; |
| 3460 |
3432 VisitForStackValue(args->at(1)); // index | 3461 VisitForStackValue(args->at(1)); // index |
3433 VisitForStackValue(args->at(2)); // value | 3462 VisitForStackValue(args->at(2)); // value |
3434 __ pop(r2); | 3463 __ pop(value); |
3435 __ pop(r1); | 3464 __ pop(index); |
3436 VisitForAccumulatorValue(args->at(0)); // string | 3465 VisitForAccumulatorValue(args->at(0)); // string |
3437 | 3466 |
3438 static const String::Encoding encoding = String::ONE_BYTE_ENCODING; | 3467 if (FLAG_debug_code) { |
3439 SeqStringSetCharGenerator::Generate(masm_, encoding, r0, r1, r2); | 3468 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; |
3440 context()->Plug(r0); | 3469 EmitSeqStringSetCharCheck(string, index, value, one_byte_seq_type); |
| 3470 } |
| 3471 |
| 3472 __ SmiUntag(value, value); |
| 3473 __ add(ip, |
| 3474 string, |
| 3475 Operand(SeqOneByteString::kHeaderSize - kHeapObjectTag)); |
| 3476 __ strb(value, MemOperand(ip, index, LSR, kSmiTagSize)); |
| 3477 context()->Plug(string); |
3441 } | 3478 } |
3442 | 3479 |
3443 | 3480 |
3444 void FullCodeGenerator::EmitTwoByteSeqStringSetChar(CallRuntime* expr) { | 3481 void FullCodeGenerator::EmitTwoByteSeqStringSetChar(CallRuntime* expr) { |
3445 ZoneList<Expression*>* args = expr->arguments(); | 3482 ZoneList<Expression*>* args = expr->arguments(); |
3446 ASSERT_EQ(3, args->length()); | 3483 ASSERT_EQ(3, args->length()); |
3447 | 3484 |
| 3485 Register string = r0; |
| 3486 Register index = r1; |
| 3487 Register value = r2; |
| 3488 |
3448 VisitForStackValue(args->at(1)); // index | 3489 VisitForStackValue(args->at(1)); // index |
3449 VisitForStackValue(args->at(2)); // value | 3490 VisitForStackValue(args->at(2)); // value |
3450 __ pop(r2); | 3491 __ pop(value); |
3451 __ pop(r1); | 3492 __ pop(index); |
3452 VisitForAccumulatorValue(args->at(0)); // string | 3493 VisitForAccumulatorValue(args->at(0)); // string |
3453 | 3494 |
3454 static const String::Encoding encoding = String::TWO_BYTE_ENCODING; | 3495 if (FLAG_debug_code) { |
3455 SeqStringSetCharGenerator::Generate(masm_, encoding, r0, r1, r2); | 3496 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; |
3456 context()->Plug(r0); | 3497 EmitSeqStringSetCharCheck(string, index, value, two_byte_seq_type); |
| 3498 } |
| 3499 |
| 3500 __ SmiUntag(value, value); |
| 3501 __ add(ip, |
| 3502 string, |
| 3503 Operand(SeqTwoByteString::kHeaderSize - kHeapObjectTag)); |
| 3504 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0); |
| 3505 __ strh(value, MemOperand(ip, index)); |
| 3506 context()->Plug(string); |
3457 } | 3507 } |
3458 | 3508 |
3459 | 3509 |
3460 | 3510 |
3461 void FullCodeGenerator::EmitMathPow(CallRuntime* expr) { | 3511 void FullCodeGenerator::EmitMathPow(CallRuntime* expr) { |
3462 // Load the arguments on the stack and call the runtime function. | 3512 // Load the arguments on the stack and call the runtime function. |
3463 ZoneList<Expression*>* args = expr->arguments(); | 3513 ZoneList<Expression*>* args = expr->arguments(); |
3464 ASSERT(args->length() == 2); | 3514 ASSERT(args->length() == 2); |
3465 VisitForStackValue(args->at(0)); | 3515 VisitForStackValue(args->at(0)); |
3466 VisitForStackValue(args->at(1)); | 3516 VisitForStackValue(args->at(1)); |
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4827 *context_length = 0; | 4877 *context_length = 0; |
4828 return previous_; | 4878 return previous_; |
4829 } | 4879 } |
4830 | 4880 |
4831 | 4881 |
4832 #undef __ | 4882 #undef __ |
4833 | 4883 |
4834 } } // namespace v8::internal | 4884 } } // namespace v8::internal |
4835 | 4885 |
4836 #endif // V8_TARGET_ARCH_ARM | 4886 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |