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

Side by Side Diff: src/execution.cc

Issue 233233004: Handlify GetProperty. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « src/debug.cc ('k') | src/factory.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 "execution.h" 5 #include "execution.h"
6 6
7 #include "bootstrapper.h" 7 #include "bootstrapper.h"
8 #include "codegen.h" 8 #include "codegen.h"
9 #include "deoptimizer.h" 9 #include "deoptimizer.h"
10 #include "isolate-inl.h" 10 #include "isolate-inl.h"
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 Handle<Object> Execution::CharAt(Handle<String> string, uint32_t index) { 724 Handle<Object> Execution::CharAt(Handle<String> string, uint32_t index) {
725 Isolate* isolate = string->GetIsolate(); 725 Isolate* isolate = string->GetIsolate();
726 Factory* factory = isolate->factory(); 726 Factory* factory = isolate->factory();
727 727
728 int int_index = static_cast<int>(index); 728 int int_index = static_cast<int>(index);
729 if (int_index < 0 || int_index >= string->length()) { 729 if (int_index < 0 || int_index >= string->length()) {
730 return factory->undefined_value(); 730 return factory->undefined_value();
731 } 731 }
732 732
733 Handle<Object> char_at = Object::GetProperty( 733 Handle<Object> char_at = Object::GetProperty(
734 isolate->js_builtins_object(), factory->char_at_string()); 734 isolate->js_builtins_object(),
735 factory->char_at_string()).ToHandleChecked();
735 if (!char_at->IsJSFunction()) { 736 if (!char_at->IsJSFunction()) {
736 return factory->undefined_value(); 737 return factory->undefined_value();
737 } 738 }
738 739
739 Handle<Object> index_object = factory->NewNumberFromInt(int_index); 740 Handle<Object> index_object = factory->NewNumberFromInt(int_index);
740 Handle<Object> index_arg[] = { index_object }; 741 Handle<Object> index_arg[] = { index_object };
741 Handle<Object> result; 742 Handle<Object> result;
742 ASSIGN_RETURN_ON_EXCEPTION_VALUE( 743 ASSIGN_RETURN_ON_EXCEPTION_VALUE(
743 isolate, result, 744 isolate, result,
744 TryCall(Handle<JSFunction>::cast(char_at), 745 TryCall(Handle<JSFunction>::cast(char_at),
745 string, 746 string,
746 ARRAY_SIZE(index_arg), 747 ARRAY_SIZE(index_arg),
747 index_arg), 748 index_arg),
748 factory->undefined_value()); 749 factory->undefined_value());
749 return result; 750 return result;
750 } 751 }
751 752
752 753
753 MaybeHandle<JSFunction> Execution::InstantiateFunction( 754 MaybeHandle<JSFunction> Execution::InstantiateFunction(
754 Handle<FunctionTemplateInfo> data) { 755 Handle<FunctionTemplateInfo> data) {
755 Isolate* isolate = data->GetIsolate(); 756 Isolate* isolate = data->GetIsolate();
756 if (!data->do_not_cache()) { 757 if (!data->do_not_cache()) {
757 // Fast case: see if the function has already been instantiated 758 // Fast case: see if the function has already been instantiated
758 int serial_number = Smi::cast(data->serial_number())->value(); 759 int serial_number = Smi::cast(data->serial_number())->value();
759 Handle<JSObject> cache(isolate->native_context()->function_cache()); 760 Handle<JSObject> cache(isolate->native_context()->function_cache());
760 Handle<Object> elm = 761 Handle<Object> elm =
761 Object::GetElementNoExceptionThrown(isolate, cache, serial_number); 762 Object::GetElement(isolate, cache, serial_number).ToHandleChecked();
762 if (elm->IsJSFunction()) return Handle<JSFunction>::cast(elm); 763 if (elm->IsJSFunction()) return Handle<JSFunction>::cast(elm);
763 } 764 }
764 // The function has not yet been instantiated in this context; do it. 765 // The function has not yet been instantiated in this context; do it.
765 Handle<Object> args[] = { data }; 766 Handle<Object> args[] = { data };
766 Handle<Object> result; 767 Handle<Object> result;
767 ASSIGN_RETURN_ON_EXCEPTION( 768 ASSIGN_RETURN_ON_EXCEPTION(
768 isolate, result, 769 isolate, result,
769 Call(isolate, 770 Call(isolate,
770 isolate->instantiate_fun(), 771 isolate->instantiate_fun(),
771 isolate->js_builtins_object(), 772 isolate->js_builtins_object(),
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 if (stack_guard->IsInstallCodeRequest()) { 986 if (stack_guard->IsInstallCodeRequest()) {
986 ASSERT(isolate->concurrent_recompilation_enabled()); 987 ASSERT(isolate->concurrent_recompilation_enabled());
987 stack_guard->Continue(INSTALL_CODE); 988 stack_guard->Continue(INSTALL_CODE);
988 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions(); 989 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions();
989 } 990 }
990 isolate->runtime_profiler()->OptimizeNow(); 991 isolate->runtime_profiler()->OptimizeNow();
991 return isolate->heap()->undefined_value(); 992 return isolate->heap()->undefined_value();
992 } 993 }
993 994
994 } } // namespace v8::internal 995 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/debug.cc ('k') | src/factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698