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 3422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3433 __ jmp(&done); | 3433 __ jmp(&done); |
3434 } | 3434 } |
3435 | 3435 |
3436 __ bind(¬_date_object); | 3436 __ bind(¬_date_object); |
3437 __ CallRuntime(Runtime::kThrowNotDateError, 0); | 3437 __ CallRuntime(Runtime::kThrowNotDateError, 0); |
3438 __ bind(&done); | 3438 __ bind(&done); |
3439 context()->Plug(result); | 3439 context()->Plug(result); |
3440 } | 3440 } |
3441 | 3441 |
3442 | 3442 |
3443 void FullCodeGenerator::EmitSeqStringSetCharCheck(Register string, | |
3444 Register index, | |
3445 Register value, | |
3446 uint32_t encoding_mask) { | |
3447 __ test(index, Immediate(kSmiTagMask)); | |
3448 __ Check(zero, kNonSmiIndex); | |
3449 __ test(value, Immediate(kSmiTagMask)); | |
3450 __ Check(zero, kNonSmiValue); | |
3451 | |
3452 __ cmp(index, FieldOperand(string, String::kLengthOffset)); | |
3453 __ Check(less, kIndexIsTooLarge); | |
3454 | |
3455 __ cmp(index, Immediate(Smi::FromInt(0))); | |
3456 __ Check(greater_equal, kIndexIsNegative); | |
3457 | |
3458 __ push(value); | |
3459 __ mov(value, FieldOperand(string, HeapObject::kMapOffset)); | |
3460 __ movzx_b(value, FieldOperand(value, Map::kInstanceTypeOffset)); | |
3461 | |
3462 __ and_(value, Immediate(kStringRepresentationMask | kStringEncodingMask)); | |
3463 __ cmp(value, Immediate(encoding_mask)); | |
3464 __ Check(equal, kUnexpectedStringType); | |
3465 __ pop(value); | |
3466 } | |
3467 | |
3468 | |
3469 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { | 3443 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { |
3470 ZoneList<Expression*>* args = expr->arguments(); | 3444 ZoneList<Expression*>* args = expr->arguments(); |
3471 ASSERT_EQ(3, args->length()); | 3445 ASSERT_EQ(3, args->length()); |
3472 | 3446 |
3473 Register string = eax; | 3447 Register string = eax; |
3474 Register index = ebx; | 3448 Register index = ebx; |
3475 Register value = ecx; | 3449 Register value = ecx; |
3476 | 3450 |
3477 VisitForStackValue(args->at(1)); // index | 3451 VisitForStackValue(args->at(1)); // index |
3478 VisitForStackValue(args->at(2)); // value | 3452 VisitForStackValue(args->at(2)); // value |
3479 __ pop(value); | 3453 __ pop(value); |
3480 __ pop(index); | 3454 __ pop(index); |
3481 VisitForAccumulatorValue(args->at(0)); // string | 3455 VisitForAccumulatorValue(args->at(0)); // string |
3482 | 3456 |
3483 | 3457 |
3484 if (FLAG_debug_code) { | 3458 if (FLAG_debug_code) { |
3485 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; | 3459 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; |
3486 EmitSeqStringSetCharCheck(string, index, value, one_byte_seq_type); | 3460 __ EmitSeqStringSetCharCheck(string, index, value, one_byte_seq_type); |
3487 } | 3461 } |
3488 | 3462 |
3489 __ SmiUntag(value); | 3463 __ SmiUntag(value); |
3490 __ SmiUntag(index); | 3464 __ SmiUntag(index); |
3491 __ mov_b(FieldOperand(string, index, times_1, SeqOneByteString::kHeaderSize), | 3465 __ mov_b(FieldOperand(string, index, times_1, SeqOneByteString::kHeaderSize), |
3492 value); | 3466 value); |
3493 context()->Plug(string); | 3467 context()->Plug(string); |
3494 } | 3468 } |
3495 | 3469 |
3496 | 3470 |
3497 void FullCodeGenerator::EmitTwoByteSeqStringSetChar(CallRuntime* expr) { | 3471 void FullCodeGenerator::EmitTwoByteSeqStringSetChar(CallRuntime* expr) { |
3498 ZoneList<Expression*>* args = expr->arguments(); | 3472 ZoneList<Expression*>* args = expr->arguments(); |
3499 ASSERT_EQ(3, args->length()); | 3473 ASSERT_EQ(3, args->length()); |
3500 | 3474 |
3501 Register string = eax; | 3475 Register string = eax; |
3502 Register index = ebx; | 3476 Register index = ebx; |
3503 Register value = ecx; | 3477 Register value = ecx; |
3504 | 3478 |
3505 VisitForStackValue(args->at(1)); // index | 3479 VisitForStackValue(args->at(1)); // index |
3506 VisitForStackValue(args->at(2)); // value | 3480 VisitForStackValue(args->at(2)); // value |
3507 __ pop(value); | 3481 __ pop(value); |
3508 __ pop(index); | 3482 __ pop(index); |
3509 VisitForAccumulatorValue(args->at(0)); // string | 3483 VisitForAccumulatorValue(args->at(0)); // string |
3510 | 3484 |
3511 if (FLAG_debug_code) { | 3485 if (FLAG_debug_code) { |
3512 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; | 3486 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; |
3513 EmitSeqStringSetCharCheck(string, index, value, two_byte_seq_type); | 3487 __ EmitSeqStringSetCharCheck(string, index, value, two_byte_seq_type); |
3514 } | 3488 } |
3515 | 3489 |
3516 __ SmiUntag(value); | 3490 __ SmiUntag(value); |
3517 // No need to untag a smi for two-byte addressing. | 3491 // No need to untag a smi for two-byte addressing. |
3518 __ mov_w(FieldOperand(string, index, times_1, SeqTwoByteString::kHeaderSize), | 3492 __ mov_w(FieldOperand(string, index, times_1, SeqTwoByteString::kHeaderSize), |
3519 value); | 3493 value); |
3520 context()->Plug(string); | 3494 context()->Plug(string); |
3521 } | 3495 } |
3522 | 3496 |
3523 | 3497 |
(...skipping 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4968 | 4942 |
4969 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4943 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
4970 Assembler::target_address_at(call_target_address)); | 4944 Assembler::target_address_at(call_target_address)); |
4971 return OSR_AFTER_STACK_CHECK; | 4945 return OSR_AFTER_STACK_CHECK; |
4972 } | 4946 } |
4973 | 4947 |
4974 | 4948 |
4975 } } // namespace v8::internal | 4949 } } // namespace v8::internal |
4976 | 4950 |
4977 #endif // V8_TARGET_ARCH_IA32 | 4951 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |