OLD | NEW |
---|---|
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 5579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5590 __ bind(&slow_case); | 5590 __ bind(&slow_case); |
5591 // Move the undefined value into the result register, which will | 5591 // Move the undefined value into the result register, which will |
5592 // trigger the slow case. | 5592 // trigger the slow case. |
5593 __ Set(temp.reg(), Immediate(Factory::undefined_value())); | 5593 __ Set(temp.reg(), Immediate(Factory::undefined_value())); |
5594 | 5594 |
5595 __ bind(&end); | 5595 __ bind(&end); |
5596 frame_->Push(&temp); | 5596 frame_->Push(&temp); |
5597 } | 5597 } |
5598 | 5598 |
5599 | 5599 |
5600 void CodeGenerator::GenerateCharFromCode(ZoneList<Expression*>* args) { | |
5601 Comment(masm_, "[ GenerateCharFromCode"); | |
5602 ASSERT(args->length() == 1); | |
5603 | |
5604 Load(args->at(0)); | |
5605 frame_->Dup(); | |
Mads Ager (chromium)
2010/02/26 17:59:06
Do you need the Dup here? You never modify code a
Vitaly Repeshko
2010/02/26 20:14:48
Well, I tried this approach and couldn't make it w
| |
5606 Result code = frame_->Pop(); | |
5607 code.ToRegister(); | |
5608 ASSERT(code.is_valid()); | |
5609 | |
5610 Result temp = allocator()->Allocate(); | |
5611 ASSERT(temp.is_valid()); | |
5612 | |
5613 JumpTarget slow_case; | |
5614 JumpTarget exit; | |
5615 | |
5616 // Fast case of Heap::LookupSingleCharacterStringFromCode. | |
5617 ASSERT(kSmiTag == 0); | |
5618 ASSERT(kSmiShiftSize == 0); | |
5619 ASSERT(IsPowerOf2(String::kMaxAsciiCharCode + 1)); | |
5620 __ test(code.reg(), | |
5621 Immediate(kSmiTagMask | | |
5622 ((~String::kMaxAsciiCharCode) << kSmiTagSize))); | |
5623 slow_case.Branch(not_zero, not_taken); | |
5624 | |
5625 __ Set(temp.reg(), Immediate(Factory::single_character_string_cache())); | |
Mads Ager (chromium)
2010/02/26 17:59:06
Adding a comment here stating that code contains a
Vitaly Repeshko
2010/02/26 20:14:48
Done.
| |
5626 ASSERT(kSmiTag == 0); | |
5627 ASSERT(kSmiTagSize == 1); | |
5628 ASSERT(kSmiShiftSize == 0); | |
5629 __ mov(temp.reg(), Operand(temp.reg(), | |
Mads Ager (chromium)
2010/02/26 17:59:06
Use FieldOperand and drop the "- kHeapObjectTag" o
Vitaly Repeshko
2010/02/26 20:14:48
Done.
| |
5630 code.reg(), times_half_pointer_size, | |
5631 FixedArray::kHeaderSize - kHeapObjectTag)); | |
5632 __ cmp(temp.reg(), Factory::undefined_value()); | |
5633 slow_case.Branch(equal, not_taken); | |
5634 code.Unuse(); | |
5635 | |
5636 frame_->SetElementAt(0, &temp); | |
5637 exit.Jump(); | |
5638 | |
5639 slow_case.Bind(); | |
5640 Result result = frame_->CallRuntime(Runtime::kCharFromCode, 1); | |
5641 frame_->Push(&result); | |
5642 | |
5643 exit.Bind(); | |
5644 } | |
5645 | |
5646 | |
5600 void CodeGenerator::GenerateIsArray(ZoneList<Expression*>* args) { | 5647 void CodeGenerator::GenerateIsArray(ZoneList<Expression*>* args) { |
5601 ASSERT(args->length() == 1); | 5648 ASSERT(args->length() == 1); |
5602 Load(args->at(0)); | 5649 Load(args->at(0)); |
5603 Result value = frame_->Pop(); | 5650 Result value = frame_->Pop(); |
5604 value.ToRegister(); | 5651 value.ToRegister(); |
5605 ASSERT(value.is_valid()); | 5652 ASSERT(value.is_valid()); |
5606 __ test(value.reg(), Immediate(kSmiTagMask)); | 5653 __ test(value.reg(), Immediate(kSmiTagMask)); |
5607 destination()->false_target()->Branch(equal); | 5654 destination()->false_target()->Branch(equal); |
5608 // It is a heap object - get map. | 5655 // It is a heap object - get map. |
5609 Result temp = allocator()->Allocate(); | 5656 Result temp = allocator()->Allocate(); |
(...skipping 5622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11232 | 11279 |
11233 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) | 11280 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) |
11234 // tagged as a small integer. | 11281 // tagged as a small integer. |
11235 __ bind(&runtime); | 11282 __ bind(&runtime); |
11236 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 11283 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); |
11237 } | 11284 } |
11238 | 11285 |
11239 #undef __ | 11286 #undef __ |
11240 | 11287 |
11241 } } // namespace v8::internal | 11288 } } // namespace v8::internal |
OLD | NEW |