Chromium Code Reviews| 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 3859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3870 __ bind(&slow_case); | 3870 __ bind(&slow_case); |
| 3871 // Move the undefined value into the result register, which will | 3871 // Move the undefined value into the result register, which will |
| 3872 // trigger the slow case. | 3872 // trigger the slow case. |
| 3873 __ LoadRoot(temp.reg(), Heap::kUndefinedValueRootIndex); | 3873 __ LoadRoot(temp.reg(), Heap::kUndefinedValueRootIndex); |
| 3874 | 3874 |
| 3875 __ bind(&end); | 3875 __ bind(&end); |
| 3876 frame_->Push(&temp); | 3876 frame_->Push(&temp); |
| 3877 } | 3877 } |
| 3878 | 3878 |
| 3879 | 3879 |
| 3880 void CodeGenerator::GenerateCharFromCode(ZoneList<Expression*>* args) { | |
| 3881 Comment(masm_, "[ GenerateCharFromCode"); | |
| 3882 ASSERT(args->length() == 1); | |
| 3883 | |
| 3884 Load(args->at(0)); | |
| 3885 frame_->Dup(); | |
| 3886 Result code = frame_->Pop(); | |
| 3887 code.ToRegister(); | |
| 3888 ASSERT(code.is_valid()); | |
| 3889 | |
| 3890 Result temp = allocator()->Allocate(); | |
| 3891 ASSERT(temp.is_valid()); | |
| 3892 | |
| 3893 JumpTarget slow_case; | |
| 3894 JumpTarget exit; | |
| 3895 | |
| 3896 // Fast case of Heap::LookupSingleCharacterStringFromCode. | |
| 3897 Condition is_smi = __ CheckSmi(code.reg()); | |
| 3898 slow_case.Branch(NegateCondition(is_smi), not_taken); | |
| 3899 | |
| 3900 __ SmiToInteger32(kScratchRegister, code.reg()); | |
| 3901 code.Unuse(); | |
| 3902 __ cmpl(kScratchRegister, Immediate(String::kMaxAsciiCharCode)); | |
| 3903 slow_case.Branch(above, not_taken); | |
| 3904 | |
| 3905 __ Move(temp.reg(), Factory::single_character_string_cache()); | |
| 3906 __ movq(temp.reg(), Operand(temp.reg(), | |
|
Mads Ager (chromium)
2010/02/26 17:59:06
FieldOperand to get rid of the "- kHeapObjectTag"
Vitaly Repeshko
2010/02/26 20:14:48
Done.
| |
| 3907 kScratchRegister, times_pointer_size, | |
| 3908 FixedArray::kHeaderSize - kHeapObjectTag)); | |
| 3909 __ Cmp(temp.reg(), Factory::undefined_value()); | |
|
Mads Ager (chromium)
2010/02/26 17:59:06
You should use CompareRoot here to use the root ar
Vitaly Repeshko
2010/02/26 20:14:48
Done.
| |
| 3910 slow_case.Branch(equal, not_taken); | |
| 3911 | |
| 3912 frame_->SetElementAt(0, &temp); | |
| 3913 exit.Jump(); | |
| 3914 | |
| 3915 slow_case.Bind(); | |
| 3916 Result result = frame_->CallRuntime(Runtime::kCharFromCode, 1); | |
| 3917 frame_->Push(&result); | |
| 3918 | |
| 3919 exit.Bind(); | |
| 3920 } | |
| 3921 | |
| 3922 | |
| 3880 void CodeGenerator::GenerateIsNonNegativeSmi(ZoneList<Expression*>* args) { | 3923 void CodeGenerator::GenerateIsNonNegativeSmi(ZoneList<Expression*>* args) { |
| 3881 ASSERT(args->length() == 1); | 3924 ASSERT(args->length() == 1); |
| 3882 Load(args->at(0)); | 3925 Load(args->at(0)); |
| 3883 Result value = frame_->Pop(); | 3926 Result value = frame_->Pop(); |
| 3884 value.ToRegister(); | 3927 value.ToRegister(); |
| 3885 ASSERT(value.is_valid()); | 3928 ASSERT(value.is_valid()); |
| 3886 Condition positive_smi = masm_->CheckPositiveSmi(value.reg()); | 3929 Condition positive_smi = masm_->CheckPositiveSmi(value.reg()); |
| 3887 value.Unuse(); | 3930 value.Unuse(); |
| 3888 destination()->Split(positive_smi); | 3931 destination()->Split(positive_smi); |
| 3889 } | 3932 } |
| (...skipping 5620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9510 // Call the function from C++. | 9553 // Call the function from C++. |
| 9511 return FUNCTION_CAST<ModuloFunction>(buffer); | 9554 return FUNCTION_CAST<ModuloFunction>(buffer); |
| 9512 } | 9555 } |
| 9513 | 9556 |
| 9514 #endif | 9557 #endif |
| 9515 | 9558 |
| 9516 | 9559 |
| 9517 #undef __ | 9560 #undef __ |
| 9518 | 9561 |
| 9519 } } // namespace v8::internal | 9562 } } // namespace v8::internal |
| OLD | NEW |