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

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

Issue 2539093002: [runtime] Port simple String.prototype.indexOf cases to TF Builtin (Closed)
Patch Set: merging with master Created 4 years 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') | src/runtime/runtime-compiler.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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 return isolate->heap()->false_value(); 530 return isolate->heap()->false_value();
531 } 531 }
532 532
533 RUNTIME_FUNCTION(Runtime_ArrayIndexOf) { 533 RUNTIME_FUNCTION(Runtime_ArrayIndexOf) {
534 HandleScope shs(isolate); 534 HandleScope shs(isolate);
535 DCHECK(args.length() == 3); 535 DCHECK(args.length() == 3);
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<Object>(0); 540 Handle<Object> receiver_obj = args.at(0);
541 if (receiver_obj->IsNull(isolate) || receiver_obj->IsUndefined(isolate)) { 541 if (receiver_obj->IsNull(isolate) || receiver_obj->IsUndefined(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( 548 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, object,
549 isolate, object, Object::ToObject(isolate, args.at<Object>(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")).
552 int64_t len; 552 int64_t len;
553 { 553 {
554 if (object->IsJSArray()) { 554 if (object->IsJSArray()) {
555 uint32_t len32 = 0; 555 uint32_t len32 = 0;
556 bool success = JSArray::cast(*object)->length()->ToArrayLength(&len32); 556 bool success = JSArray::cast(*object)->length()->ToArrayLength(&len32);
557 DCHECK(success); 557 DCHECK(success);
558 USE(success); 558 USE(success);
559 len = len32; 559 len = len32;
(...skipping 83 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/runtime/runtime.h ('k') | src/runtime/runtime-compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698