OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 #include "src/code-stub-assembler.h" | 4 #include "src/code-stub-assembler.h" |
5 #include "src/code-factory.h" | 5 #include "src/code-factory.h" |
6 #include "src/frames-inl.h" | 6 #include "src/frames-inl.h" |
7 #include "src/frames.h" | 7 #include "src/frames.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 3134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3145 Int32GreaterThanOrEqual(instance_type, | 3145 Int32GreaterThanOrEqual(instance_type, |
3146 Int32Constant(FIRST_FIXED_TYPED_ARRAY_TYPE)), | 3146 Int32Constant(FIRST_FIXED_TYPED_ARRAY_TYPE)), |
3147 Int32LessThanOrEqual(instance_type, | 3147 Int32LessThanOrEqual(instance_type, |
3148 Int32Constant(LAST_FIXED_TYPED_ARRAY_TYPE))); | 3148 Int32Constant(LAST_FIXED_TYPED_ARRAY_TYPE))); |
3149 } | 3149 } |
3150 | 3150 |
3151 Node* CodeStubAssembler::IsJSRegExp(Node* object) { | 3151 Node* CodeStubAssembler::IsJSRegExp(Node* object) { |
3152 return HasInstanceType(object, JS_REGEXP_TYPE); | 3152 return HasInstanceType(object, JS_REGEXP_TYPE); |
3153 } | 3153 } |
3154 | 3154 |
| 3155 Node* CodeStubAssembler::IsNumber(Node* object) { |
| 3156 return Select(TaggedIsSmi(object), [=] { return Int32Constant(1); }, |
| 3157 [=] { return IsHeapNumber(object); }, |
| 3158 MachineRepresentation::kWord32); |
| 3159 } |
| 3160 |
| 3161 Node* CodeStubAssembler::IsNumberNormalized(Node* number) { |
| 3162 CSA_ASSERT(this, IsNumber(number)); |
| 3163 |
| 3164 VARIABLE(var_result, MachineRepresentation::kWord32, Int32Constant(1)); |
| 3165 Label out(this); |
| 3166 |
| 3167 GotoIf(TaggedIsSmi(number), &out); |
| 3168 |
| 3169 Node* const value = LoadHeapNumberValue(number); |
| 3170 Node* const smi_min = Float64Constant(static_cast<double>(Smi::kMinValue)); |
| 3171 Node* const smi_max = Float64Constant(static_cast<double>(Smi::kMaxValue)); |
| 3172 |
| 3173 GotoIf(Float64LessThan(value, smi_min), &out); |
| 3174 GotoIf(Float64GreaterThan(value, smi_max), &out); |
| 3175 GotoIfNot(Float64Equal(value, value), &out); // NaN. |
| 3176 |
| 3177 var_result.Bind(Int32Constant(0)); |
| 3178 Goto(&out); |
| 3179 |
| 3180 BIND(&out); |
| 3181 return var_result.value(); |
| 3182 } |
| 3183 |
3155 Node* CodeStubAssembler::StringCharCodeAt(Node* string, Node* index, | 3184 Node* CodeStubAssembler::StringCharCodeAt(Node* string, Node* index, |
3156 ParameterMode parameter_mode) { | 3185 ParameterMode parameter_mode) { |
3157 CSA_ASSERT(this, IsString(string)); | 3186 CSA_ASSERT(this, IsString(string)); |
3158 | 3187 |
3159 // Translate the {index} into a Word. | 3188 // Translate the {index} into a Word. |
3160 Node* const int_index = ParameterToWord(index, parameter_mode); | 3189 Node* const int_index = ParameterToWord(index, parameter_mode); |
3161 | 3190 |
3162 VARIABLE(var_result, MachineRepresentation::kWord32); | 3191 VARIABLE(var_result, MachineRepresentation::kWord32); |
3163 | 3192 |
3164 Label out(this, &var_result), runtime_generic(this), runtime_external(this); | 3193 Label out(this, &var_result), runtime_generic(this), runtime_external(this); |
(...skipping 5344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8509 formatted.c_str(), TENURED); | 8538 formatted.c_str(), TENURED); |
8510 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), | 8539 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), |
8511 HeapConstant(string)); | 8540 HeapConstant(string)); |
8512 } | 8541 } |
8513 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value); | 8542 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value); |
8514 #endif | 8543 #endif |
8515 } | 8544 } |
8516 | 8545 |
8517 } // namespace internal | 8546 } // namespace internal |
8518 } // namespace v8 | 8547 } // namespace v8 |
OLD | NEW |