OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 DCHECK_EQ(static_cast<int>(subject->hash_field()), | 178 DCHECK_EQ(static_cast<int>(subject->hash_field()), |
179 static_cast<int>(hash)); | 179 static_cast<int>(hash)); |
180 #endif | 180 #endif |
181 subject->set_hash_field(hash); | 181 subject->set_hash_field(hash); |
182 } | 182 } |
183 return Smi::FromInt(d); | 183 return Smi::FromInt(d); |
184 } | 184 } |
185 } | 185 } |
186 | 186 |
187 // Slower case. | 187 // Slower case. |
188 int flags = ALLOW_HEX; | 188 int flags = ALLOW_HEX | ALLOW_OCTAL | ALLOW_BINARY; |
189 if (FLAG_harmony_numeric_literals) { | |
190 // The current spec draft has not updated "ToNumber Applied to the String | |
191 // Type", https://bugs.ecmascript.org/show_bug.cgi?id=1584 | |
192 flags |= ALLOW_OCTAL | ALLOW_BINARY; | |
193 } | |
194 | |
195 return *isolate->factory()->NewNumber( | 189 return *isolate->factory()->NewNumber( |
196 StringToDouble(isolate->unicode_cache(), subject, flags)); | 190 StringToDouble(isolate->unicode_cache(), subject, flags)); |
197 } | 191 } |
198 | 192 |
199 | 193 |
200 RUNTIME_FUNCTION(Runtime_StringParseInt) { | 194 RUNTIME_FUNCTION(Runtime_StringParseInt) { |
201 HandleScope handle_scope(isolate); | 195 HandleScope handle_scope(isolate); |
202 DCHECK(args.length() == 2); | 196 DCHECK(args.length() == 2); |
203 CONVERT_ARG_HANDLE_CHECKED(String, subject, 0); | 197 CONVERT_ARG_HANDLE_CHECKED(String, subject, 0); |
204 CONVERT_NUMBER_CHECKED(int, radix, Int32, args[1]); | 198 CONVERT_NUMBER_CHECKED(int, radix, Int32, args[1]); |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 | 582 |
589 RUNTIME_FUNCTION(Runtime_IsNonNegativeSmi) { | 583 RUNTIME_FUNCTION(Runtime_IsNonNegativeSmi) { |
590 SealHandleScope shs(isolate); | 584 SealHandleScope shs(isolate); |
591 DCHECK(args.length() == 1); | 585 DCHECK(args.length() == 1); |
592 CONVERT_ARG_CHECKED(Object, obj, 0); | 586 CONVERT_ARG_CHECKED(Object, obj, 0); |
593 return isolate->heap()->ToBoolean(obj->IsSmi() && | 587 return isolate->heap()->ToBoolean(obj->IsSmi() && |
594 Smi::cast(obj)->value() >= 0); | 588 Smi::cast(obj)->value() >= 0); |
595 } | 589 } |
596 } | 590 } |
597 } // namespace v8::internal | 591 } // namespace v8::internal |
OLD | NEW |