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

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

Issue 2853393002: [builtins] Migrate Object.keys to CodeStubAssembler builtin. (Closed)
Patch Set: Really fix the test, meh. Created 3 years, 7 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/runtime/runtime.h ('k') | test/mjsunit/object-keys.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 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/arguments.h" 7 #include "src/arguments.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/debug/debug.h" 9 #include "src/debug/debug.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 if (DeleteObjectPropertyFast(isolate, receiver, key)) return Just(true); 191 if (DeleteObjectPropertyFast(isolate, receiver, key)) return Just(true);
192 192
193 bool success = false; 193 bool success = false;
194 LookupIterator it = LookupIterator::PropertyOrElement( 194 LookupIterator it = LookupIterator::PropertyOrElement(
195 isolate, receiver, key, &success, LookupIterator::OWN); 195 isolate, receiver, key, &success, LookupIterator::OWN);
196 if (!success) return Nothing<bool>(); 196 if (!success) return Nothing<bool>();
197 197
198 return JSReceiver::DeleteProperty(&it, language_mode); 198 return JSReceiver::DeleteProperty(&it, language_mode);
199 } 199 }
200 200
201 // ES #sec-object.keys
202 RUNTIME_FUNCTION(Runtime_ObjectKeys) {
203 HandleScope scope(isolate);
204 Handle<Object> object = args.at(0);
205
206 // Convert the {object} to a proper {receiver}.
207 Handle<JSReceiver> receiver;
208 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, receiver,
209 Object::ToObject(isolate, object));
210
211 // Collect the own keys for the {receiver}.
212 Handle<FixedArray> keys;
213 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
214 isolate, keys,
215 KeyAccumulator::GetKeys(receiver, KeyCollectionMode::kOwnOnly,
216 ENUMERABLE_STRINGS,
217 GetKeysConversion::kConvertToString));
218 return *keys;
219 }
220
201 // ES6 19.1.3.2 221 // ES6 19.1.3.2
202 RUNTIME_FUNCTION(Runtime_ObjectHasOwnProperty) { 222 RUNTIME_FUNCTION(Runtime_ObjectHasOwnProperty) {
203 HandleScope scope(isolate); 223 HandleScope scope(isolate);
204 Handle<Object> property = args.at(1); 224 Handle<Object> property = args.at(1);
205 225
206 Handle<Name> key; 226 Handle<Name> key;
207 uint32_t index; 227 uint32_t index;
208 bool key_is_array_index = property->ToArrayIndex(&index); 228 bool key_is_array_index = property->ToArrayIndex(&index);
209 229
210 if (!key_is_array_index) { 230 if (!key_is_array_index) {
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 // While iteration alone may not have observable side-effects, calling 1116 // While iteration alone may not have observable side-effects, calling
1097 // toNumber on an object will. Make sure the arg is not an array of objects. 1117 // toNumber on an object will. Make sure the arg is not an array of objects.
1098 ElementsKind kind = JSObject::cast(*obj)->GetElementsKind(); 1118 ElementsKind kind = JSObject::cast(*obj)->GetElementsKind();
1099 if (!IsFastNumberElementsKind(kind)) return isolate->heap()->ToBoolean(false); 1119 if (!IsFastNumberElementsKind(kind)) return isolate->heap()->ToBoolean(false);
1100 1120
1101 return isolate->heap()->ToBoolean(!obj->IterationHasObservableEffects()); 1121 return isolate->heap()->ToBoolean(!obj->IterationHasObservableEffects());
1102 } 1122 }
1103 1123
1104 } // namespace internal 1124 } // namespace internal
1105 } // namespace v8 1125 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | test/mjsunit/object-keys.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698