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

Side by Side Diff: src/execution.cc

Issue 1143153004: Remove Execution::CharAt (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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/execution.h ('k') | src/runtime/runtime-object.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/execution.h" 5 #include "src/execution.h"
6 6
7 #include "src/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/messages.h" 10 #include "src/messages.h"
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 isolate->native_context()->regexp_function()); 595 isolate->native_context()->regexp_function());
596 Handle<Object> re_obj; 596 Handle<Object> re_obj;
597 ASSIGN_RETURN_ON_EXCEPTION( 597 ASSIGN_RETURN_ON_EXCEPTION(
598 isolate, re_obj, 598 isolate, re_obj,
599 RegExpImpl::CreateRegExpLiteral(function, pattern, flags), 599 RegExpImpl::CreateRegExpLiteral(function, pattern, flags),
600 JSRegExp); 600 JSRegExp);
601 return Handle<JSRegExp>::cast(re_obj); 601 return Handle<JSRegExp>::cast(re_obj);
602 } 602 }
603 603
604 604
605 Handle<Object> Execution::CharAt(Handle<String> string, uint32_t index) {
606 Isolate* isolate = string->GetIsolate();
607 Factory* factory = isolate->factory();
608
609 int int_index = static_cast<int>(index);
610 if (int_index < 0 || int_index >= string->length()) {
611 return factory->undefined_value();
612 }
613
614 Handle<Object> char_at = Object::GetProperty(
615 isolate->js_builtins_object(),
616 factory->char_at_string()).ToHandleChecked();
617 if (!char_at->IsJSFunction()) {
618 return factory->undefined_value();
619 }
620
621 Handle<Object> index_object = factory->NewNumberFromInt(int_index);
622 Handle<Object> index_arg[] = { index_object };
623 Handle<Object> result;
624 if (!TryCall(Handle<JSFunction>::cast(char_at),
625 string,
626 arraysize(index_arg),
627 index_arg).ToHandle(&result)) {
628 return factory->undefined_value();
629 }
630 return result;
631 }
632
633
634 Handle<String> Execution::GetStackTraceLine(Handle<Object> recv, 605 Handle<String> Execution::GetStackTraceLine(Handle<Object> recv,
635 Handle<JSFunction> fun, 606 Handle<JSFunction> fun,
636 Handle<Object> pos, 607 Handle<Object> pos,
637 Handle<Object> is_global) { 608 Handle<Object> is_global) {
638 Isolate* isolate = fun->GetIsolate(); 609 Isolate* isolate = fun->GetIsolate();
639 Handle<Object> args[] = { recv, fun, pos, is_global }; 610 Handle<Object> args[] = { recv, fun, pos, is_global };
640 MaybeHandle<Object> maybe_result = 611 MaybeHandle<Object> maybe_result =
641 TryCall(isolate->get_stack_trace_line_fun(), 612 TryCall(isolate->get_stack_trace_line_fun(),
642 isolate->js_builtins_object(), 613 isolate->js_builtins_object(),
643 arraysize(args), 614 arraysize(args),
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 } 657 }
687 658
688 isolate_->counters()->stack_interrupts()->Increment(); 659 isolate_->counters()->stack_interrupts()->Increment();
689 isolate_->counters()->runtime_profiler_ticks()->Increment(); 660 isolate_->counters()->runtime_profiler_ticks()->Increment();
690 isolate_->runtime_profiler()->OptimizeNow(); 661 isolate_->runtime_profiler()->OptimizeNow();
691 662
692 return isolate_->heap()->undefined_value(); 663 return isolate_->heap()->undefined_value();
693 } 664 }
694 665
695 } } // namespace v8::internal 666 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/execution.h ('k') | src/runtime/runtime-object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698