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

Side by Side Diff: src/runtime/runtime-scopes.cc

Issue 1306303003: [es6] Implement spec compliant ToPrimitive in the runtime. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address Michis comments. Created 5 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
OLDNEW
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/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/arguments.h" 8 #include "src/arguments.h"
9 #include "src/frames-inl.h" 9 #include "src/frames-inl.h"
10 #include "src/messages.h" 10 #include "src/messages.h"
(...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 1132 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1133 isolate, result, 1133 isolate, result,
1134 Object::GetProperty(isolate->initial_object_prototype(), 1134 Object::GetProperty(isolate->initial_object_prototype(),
1135 Handle<Symbol>::cast(raw_key))); 1135 Handle<Symbol>::cast(raw_key)));
1136 return *result; 1136 return *result;
1137 } 1137 }
1138 1138
1139 // Convert the key to a string. 1139 // Convert the key to a string.
1140 Handle<Object> converted; 1140 Handle<Object> converted;
1141 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, converted, 1141 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, converted,
1142 Execution::ToString(isolate, raw_key)); 1142 Object::ToString(isolate, raw_key));
1143 Handle<String> key = Handle<String>::cast(converted); 1143 Handle<String> key = Handle<String>::cast(converted);
1144 1144
1145 // Try to convert the string key into an array index. 1145 // Try to convert the string key into an array index.
1146 if (key->AsArrayIndex(&index)) { 1146 if (key->AsArrayIndex(&index)) {
1147 if (index < n) { 1147 if (index < n) {
1148 return frame->GetParameter(index); 1148 return frame->GetParameter(index);
1149 } else { 1149 } else {
1150 Handle<Object> initial_prototype(isolate->initial_object_prototype()); 1150 Handle<Object> initial_prototype(isolate->initial_object_prototype());
1151 Handle<Object> result; 1151 Handle<Object> result;
1152 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 1152 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
(...skipping 18 matching lines...) Expand all
1171 1171
1172 // Lookup in the initial Object.prototype object. 1172 // Lookup in the initial Object.prototype object.
1173 Handle<Object> result; 1173 Handle<Object> result;
1174 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 1174 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1175 isolate, result, 1175 isolate, result,
1176 Object::GetProperty(isolate->initial_object_prototype(), key)); 1176 Object::GetProperty(isolate->initial_object_prototype(), key));
1177 return *result; 1177 return *result;
1178 } 1178 }
1179 } // namespace internal 1179 } // namespace internal
1180 } // namespace v8 1180 } // namespace v8
OLDNEW
« src/objects.cc ('K') | « src/runtime/runtime-object.cc ('k') | src/symbol.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698