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

Side by Side Diff: src/objects.cc

Issue 1365503005: [es6] Fix invalid ToString in implementation of ToName. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Meh! Created 5 years, 2 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
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 JSFunction::cast(native_context->get(constructor_function_index)), 87 JSFunction::cast(native_context->get(constructor_function_index)),
88 isolate); 88 isolate);
89 } 89 }
90 Handle<JSObject> result = isolate->factory()->NewJSObject(constructor); 90 Handle<JSObject> result = isolate->factory()->NewJSObject(constructor);
91 Handle<JSValue>::cast(result)->set_value(*object); 91 Handle<JSValue>::cast(result)->set_value(*object);
92 return result; 92 return result;
93 } 93 }
94 94
95 95
96 // static 96 // static
97 MaybeHandle<Name> Object::ToName(Isolate* isolate, Handle<Object> input) {
98 ASSIGN_RETURN_ON_EXCEPTION(
99 isolate, input, Object::ToPrimitive(input, ToPrimitiveHint::kString),
100 Name);
101 if (input->IsName()) return Handle<Name>::cast(input);
102 return ToString(isolate, input);
103 }
104
105
106 // static
97 MaybeHandle<Object> Object::ToNumber(Handle<Object> input) { 107 MaybeHandle<Object> Object::ToNumber(Handle<Object> input) {
98 while (true) { 108 while (true) {
99 if (input->IsNumber()) { 109 if (input->IsNumber()) {
100 return input; 110 return input;
101 } 111 }
102 if (input->IsString()) { 112 if (input->IsString()) {
103 return String::ToNumber(Handle<String>::cast(input)); 113 return String::ToNumber(Handle<String>::cast(input));
104 } 114 }
105 if (input->IsOddball()) { 115 if (input->IsOddball()) {
106 return Oddball::ToNumber(Handle<Oddball>::cast(input)); 116 return Oddball::ToNumber(Handle<Oddball>::cast(input));
(...skipping 16638 matching lines...) Expand 10 before | Expand all | Expand 10 after
16745 if (cell->value() != *new_value) { 16755 if (cell->value() != *new_value) {
16746 cell->set_value(*new_value); 16756 cell->set_value(*new_value);
16747 Isolate* isolate = cell->GetIsolate(); 16757 Isolate* isolate = cell->GetIsolate();
16748 cell->dependent_code()->DeoptimizeDependentCodeGroup( 16758 cell->dependent_code()->DeoptimizeDependentCodeGroup(
16749 isolate, DependentCode::kPropertyCellChangedGroup); 16759 isolate, DependentCode::kPropertyCellChangedGroup);
16750 } 16760 }
16751 } 16761 }
16752 16762
16753 } // namespace internal 16763 } // namespace internal
16754 } // namespace v8 16764 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698