Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: src/runtime.cc

Issue 587873002: ES6: Disallow binary and octal representation in Number (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/harmony/numeric-literals.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <stdlib.h> 5 #include <stdlib.h>
6 #include <limits> 6 #include <limits>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 6266 matching lines...) Expand 10 before | Expand all | Expand 10 after
6277 DCHECK_EQ(static_cast<int>(subject->hash_field()), 6277 DCHECK_EQ(static_cast<int>(subject->hash_field()),
6278 static_cast<int>(hash)); 6278 static_cast<int>(hash));
6279 #endif 6279 #endif
6280 subject->set_hash_field(hash); 6280 subject->set_hash_field(hash);
6281 } 6281 }
6282 return Smi::FromInt(d); 6282 return Smi::FromInt(d);
6283 } 6283 }
6284 } 6284 }
6285 6285
6286 // Slower case. 6286 // Slower case.
6287 int flags = ALLOW_HEX; 6287 // Octal and binary are not allowed in ToNumber.
6288 if (FLAG_harmony_numeric_literals) { 6288 return *isolate->factory()->NewNumber(
6289 // The current spec draft has not updated "ToNumber Applied to the String 6289 StringToDouble(isolate->unicode_cache(), *subject, ALLOW_HEX));
6290 // Type", https://bugs.ecmascript.org/show_bug.cgi?id=1584
6291 flags |= ALLOW_OCTAL | ALLOW_BINARY;
6292 }
6293
6294 return *isolate->factory()->NewNumber(StringToDouble(
6295 isolate->unicode_cache(), *subject, flags));
6296 } 6290 }
6297 6291
6298 6292
6299 RUNTIME_FUNCTION(Runtime_NewString) { 6293 RUNTIME_FUNCTION(Runtime_NewString) {
6300 HandleScope scope(isolate); 6294 HandleScope scope(isolate);
6301 DCHECK(args.length() == 2); 6295 DCHECK(args.length() == 2);
6302 CONVERT_INT32_ARG_CHECKED(length, 0); 6296 CONVERT_INT32_ARG_CHECKED(length, 0);
6303 CONVERT_BOOLEAN_ARG_CHECKED(is_one_byte, 1); 6297 CONVERT_BOOLEAN_ARG_CHECKED(is_one_byte, 1);
6304 if (length == 0) return isolate->heap()->empty_string(); 6298 if (length == 0) return isolate->heap()->empty_string();
6305 Handle<String> result; 6299 Handle<String> result;
(...skipping 9433 matching lines...) Expand 10 before | Expand all | Expand 10 after
15739 } 15733 }
15740 return NULL; 15734 return NULL;
15741 } 15735 }
15742 15736
15743 15737
15744 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 15738 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
15745 return &(kIntrinsicFunctions[static_cast<int>(id)]); 15739 return &(kIntrinsicFunctions[static_cast<int>(id)]);
15746 } 15740 }
15747 15741
15748 } } // namespace v8::internal 15742 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/harmony/numeric-literals.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698