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

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

Issue 2601503002: Add Object::IsNullOrUndefined(Isolate*) helper method (Closed)
Patch Set: fixing merge conflicts Created 3 years, 11 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-inl.h ('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 "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/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/conversions-inl.h" 9 #include "src/conversions-inl.h"
10 #include "src/elements.h" 10 #include "src/elements.h"
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 } 531 }
532 532
533 RUNTIME_FUNCTION(Runtime_ArrayIndexOf) { 533 RUNTIME_FUNCTION(Runtime_ArrayIndexOf) {
534 HandleScope shs(isolate); 534 HandleScope shs(isolate);
535 DCHECK_EQ(3, args.length()); 535 DCHECK_EQ(3, args.length());
536 CONVERT_ARG_HANDLE_CHECKED(Object, search_element, 1); 536 CONVERT_ARG_HANDLE_CHECKED(Object, search_element, 1);
537 CONVERT_ARG_HANDLE_CHECKED(Object, from_index, 2); 537 CONVERT_ARG_HANDLE_CHECKED(Object, from_index, 2);
538 538
539 // Let O be ? ToObject(this value). 539 // Let O be ? ToObject(this value).
540 Handle<Object> receiver_obj = args.at(0); 540 Handle<Object> receiver_obj = args.at(0);
541 if (receiver_obj->IsNull(isolate) || receiver_obj->IsUndefined(isolate)) { 541 if (receiver_obj->IsNullOrUndefined(isolate)) {
542 THROW_NEW_ERROR_RETURN_FAILURE( 542 THROW_NEW_ERROR_RETURN_FAILURE(
543 isolate, NewTypeError(MessageTemplate::kCalledOnNullOrUndefined, 543 isolate, NewTypeError(MessageTemplate::kCalledOnNullOrUndefined,
544 isolate->factory()->NewStringFromAsciiChecked( 544 isolate->factory()->NewStringFromAsciiChecked(
545 "Array.prototype.indexOf"))); 545 "Array.prototype.indexOf")));
546 } 546 }
547 Handle<JSReceiver> object; 547 Handle<JSReceiver> object;
548 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, object, 548 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, object,
549 Object::ToObject(isolate, args.at(0))); 549 Object::ToObject(isolate, args.at(0)));
550 550
551 // Let len be ? ToLength(? Get(O, "length")). 551 // Let len be ? ToLength(? Get(O, "length")).
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 isolate, spread, 643 isolate, spread,
644 Execution::Call(isolate, spread_iterable_function, 644 Execution::Call(isolate, spread_iterable_function,
645 isolate->factory()->undefined_value(), 1, &spread)); 645 isolate->factory()->undefined_value(), 1, &spread));
646 } 646 }
647 647
648 return *spread; 648 return *spread;
649 } 649 }
650 650
651 } // namespace internal 651 } // namespace internal
652 } // namespace v8 652 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/runtime/runtime-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698