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

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

Issue 1172683003: Use the LookupIterator for SetElement and friends (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 years, 6 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-array.cc ('k') | src/runtime/runtime-debug.cc » ('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 <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/arguments.h" 10 #include "src/arguments.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 RUNTIME_FUNCTION(Runtime_DefineClassMethod) { 196 RUNTIME_FUNCTION(Runtime_DefineClassMethod) {
197 HandleScope scope(isolate); 197 HandleScope scope(isolate);
198 DCHECK(args.length() == 3); 198 DCHECK(args.length() == 3);
199 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); 199 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
200 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); 200 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
201 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 2); 201 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 2);
202 202
203 uint32_t index; 203 uint32_t index;
204 if (name->AsArrayIndex(&index)) { 204 if (name->AsArrayIndex(&index)) {
205 RETURN_FAILURE_ON_EXCEPTION( 205 RETURN_FAILURE_ON_EXCEPTION(
206 isolate, 206 isolate, JSObject::SetOwnElementIgnoreAttributes(object, index,
207 JSObject::SetOwnElement(object, index, function, DONT_ENUM, STRICT)); 207 function, DONT_ENUM));
208 } else { 208 } else {
209 RETURN_FAILURE_ON_EXCEPTION( 209 RETURN_FAILURE_ON_EXCEPTION(
210 isolate, JSObject::SetOwnPropertyIgnoreAttributes(object, name, 210 isolate, JSObject::SetOwnPropertyIgnoreAttributes(object, name,
211 function, DONT_ENUM)); 211 function, DONT_ENUM));
212 } 212 }
213 return isolate->heap()->undefined_value(); 213 return isolate->heap()->undefined_value();
214 } 214 }
215 215
216 216
217 RUNTIME_FUNCTION(Runtime_ClassGetSourceCode) { 217 RUNTIME_FUNCTION(Runtime_ClassGetSourceCode) {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 LanguageMode language_mode) { 350 LanguageMode language_mode) {
351 if (home_object->IsAccessCheckNeeded() && !isolate->MayAccess(home_object)) { 351 if (home_object->IsAccessCheckNeeded() && !isolate->MayAccess(home_object)) {
352 isolate->ReportFailedAccessCheck(home_object); 352 isolate->ReportFailedAccessCheck(home_object);
353 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); 353 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
354 } 354 }
355 355
356 PrototypeIterator iter(isolate, home_object); 356 PrototypeIterator iter(isolate, home_object);
357 Handle<Object> proto = PrototypeIterator::GetCurrent(iter); 357 Handle<Object> proto = PrototypeIterator::GetCurrent(iter);
358 if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value(); 358 if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value();
359 359
360 LookupIterator it(isolate, receiver, index, Handle<JSReceiver>::cast(proto));
360 Handle<Object> result; 361 Handle<Object> result;
361 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 362 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
362 isolate, result, 363 isolate, result,
363 Object::SetElementWithReceiver(isolate, proto, receiver, index, value, 364 Object::SetSuperProperty(&it, value, language_mode,
364 language_mode)); 365 Object::MAY_BE_STORE_FROM_KEYED));
365 return *result; 366 return *result;
366 } 367 }
367 368
368 369
369 RUNTIME_FUNCTION(Runtime_StoreToSuper_Strict) { 370 RUNTIME_FUNCTION(Runtime_StoreToSuper_Strict) {
370 HandleScope scope(isolate); 371 HandleScope scope(isolate);
371 DCHECK(args.length() == 4); 372 DCHECK(args.length() == 4);
372 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0); 373 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0);
373 CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1); 374 CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1);
374 CONVERT_ARG_HANDLE_CHECKED(Name, name, 2); 375 CONVERT_ARG_HANDLE_CHECKED(Name, name, 2);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 return nullptr; 455 return nullptr;
455 } 456 }
456 457
457 458
458 RUNTIME_FUNCTION(Runtime_CallSuperWithSpread) { 459 RUNTIME_FUNCTION(Runtime_CallSuperWithSpread) {
459 UNIMPLEMENTED(); 460 UNIMPLEMENTED();
460 return nullptr; 461 return nullptr;
461 } 462 }
462 } // namespace internal 463 } // namespace internal
463 } // namespace v8 464 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime-array.cc ('k') | src/runtime/runtime-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698