| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |