OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 2047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2058 __ mov_b(scratch, Operand(src, 0)); | 2058 __ mov_b(scratch, Operand(src, 0)); |
2059 __ mov_b(Operand(dest, 0), scratch); | 2059 __ mov_b(Operand(dest, 0), scratch); |
2060 __ inc(src); | 2060 __ inc(src); |
2061 __ inc(dest); | 2061 __ inc(dest); |
2062 __ dec(count); | 2062 __ dec(count); |
2063 __ j(not_zero, &loop); | 2063 __ j(not_zero, &loop); |
2064 | 2064 |
2065 __ bind(&done); | 2065 __ bind(&done); |
2066 } | 2066 } |
2067 | 2067 |
2068 void ToStringStub::Generate(MacroAssembler* masm) { | |
2069 // The ToString stub takes one argument in eax. | |
2070 Label is_number; | |
2071 __ JumpIfSmi(eax, &is_number, Label::kNear); | |
2072 | |
2073 Label not_string; | |
2074 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edi); | |
2075 // eax: receiver | |
2076 // edi: receiver map | |
2077 __ j(above_equal, ¬_string, Label::kNear); | |
2078 __ Ret(); | |
2079 __ bind(¬_string); | |
2080 | |
2081 Label not_heap_number; | |
2082 __ CompareMap(eax, masm->isolate()->factory()->heap_number_map()); | |
2083 __ j(not_equal, ¬_heap_number, Label::kNear); | |
2084 __ bind(&is_number); | |
2085 NumberToStringStub stub(isolate()); | |
2086 __ TailCallStub(&stub); | |
2087 __ bind(¬_heap_number); | |
2088 | |
2089 Label not_oddball; | |
2090 __ CmpInstanceType(edi, ODDBALL_TYPE); | |
2091 __ j(not_equal, ¬_oddball, Label::kNear); | |
2092 __ mov(eax, FieldOperand(eax, Oddball::kToStringOffset)); | |
2093 __ Ret(); | |
2094 __ bind(¬_oddball); | |
2095 | |
2096 __ pop(ecx); // Pop return address. | |
2097 __ push(eax); // Push argument. | |
2098 __ push(ecx); // Push return address. | |
2099 __ TailCallRuntime(Runtime::kToString); | |
2100 } | |
2101 | |
2102 | 2068 |
2103 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, | 2069 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, |
2104 Register left, | 2070 Register left, |
2105 Register right, | 2071 Register right, |
2106 Register scratch1, | 2072 Register scratch1, |
2107 Register scratch2) { | 2073 Register scratch2) { |
2108 Register length = scratch1; | 2074 Register length = scratch1; |
2109 | 2075 |
2110 // Compare lengths. | 2076 // Compare lengths. |
2111 Label strings_not_equal, check_zero_length; | 2077 Label strings_not_equal, check_zero_length; |
(...skipping 3126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5238 kStackUnwindSpace, nullptr, return_value_operand, | 5204 kStackUnwindSpace, nullptr, return_value_operand, |
5239 NULL); | 5205 NULL); |
5240 } | 5206 } |
5241 | 5207 |
5242 #undef __ | 5208 #undef __ |
5243 | 5209 |
5244 } // namespace internal | 5210 } // namespace internal |
5245 } // namespace v8 | 5211 } // namespace v8 |
5246 | 5212 |
5247 #endif // V8_TARGET_ARCH_IA32 | 5213 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |