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

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') | src/objects.h » ('J')
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 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 Handle<Object> Execution::CharAt(Handle<String> string, uint32_t index) { 744 Handle<Object> Execution::CharAt(Handle<String> string, uint32_t index) {
745 Isolate* isolate = string->GetIsolate(); 745 Isolate* isolate = string->GetIsolate();
746 Factory* factory = isolate->factory(); 746 Factory* factory = isolate->factory();
747 747
748 int int_index = static_cast<int>(index); 748 int int_index = static_cast<int>(index);
749 if (int_index < 0 || int_index >= string->length()) { 749 if (int_index < 0 || int_index >= string->length()) {
750 return factory->undefined_value(); 750 return factory->undefined_value();
751 } 751 }
752 752
753 Handle<Object> char_at = Object::GetProperty( 753 Handle<Object> char_at = Object::GetProperty(
754 isolate->js_builtins_object(), factory->char_at_string()); 754 isolate->js_builtins_object(),
755 factory->char_at_string()).ToHandleChecked();
755 if (!char_at->IsJSFunction()) { 756 if (!char_at->IsJSFunction()) {
756 return factory->undefined_value(); 757 return factory->undefined_value();
757 } 758 }
758 759
759 bool caught_exception; 760 bool caught_exception;
760 Handle<Object> index_object = factory->NewNumberFromInt(int_index); 761 Handle<Object> index_object = factory->NewNumberFromInt(int_index);
761 Handle<Object> index_arg[] = { index_object }; 762 Handle<Object> index_arg[] = { index_object };
762 Handle<Object> result = TryCall(Handle<JSFunction>::cast(char_at), 763 Handle<Object> result = TryCall(Handle<JSFunction>::cast(char_at),
763 string, 764 string,
764 ARRAY_SIZE(index_arg), 765 ARRAY_SIZE(index_arg),
765 index_arg, 766 index_arg,
766 &caught_exception); 767 &caught_exception);
767 if (caught_exception) { 768 if (caught_exception) {
768 return factory->undefined_value(); 769 return factory->undefined_value();
769 } 770 }
770 return result; 771 return result;
771 } 772 }
772 773
773 774
774 Handle<JSFunction> Execution::InstantiateFunction( 775 Handle<JSFunction> Execution::InstantiateFunction(
775 Handle<FunctionTemplateInfo> data, 776 Handle<FunctionTemplateInfo> data,
776 bool* exc) { 777 bool* exc) {
777 Isolate* isolate = data->GetIsolate(); 778 Isolate* isolate = data->GetIsolate();
778 if (!data->do_not_cache()) { 779 if (!data->do_not_cache()) {
779 // Fast case: see if the function has already been instantiated 780 // Fast case: see if the function has already been instantiated
780 int serial_number = Smi::cast(data->serial_number())->value(); 781 int serial_number = Smi::cast(data->serial_number())->value();
781 Handle<JSObject> cache(isolate->native_context()->function_cache()); 782 Handle<JSObject> cache(isolate->native_context()->function_cache());
782 Handle<Object> elm = 783 Handle<Object> elm =
783 Object::GetElementNoExceptionThrown(isolate, cache, serial_number); 784 Object::GetElement(isolate, cache, serial_number).ToHandleChecked();
784 if (elm->IsJSFunction()) return Handle<JSFunction>::cast(elm); 785 if (elm->IsJSFunction()) return Handle<JSFunction>::cast(elm);
785 } 786 }
786 // The function has not yet been instantiated in this context; do it. 787 // The function has not yet been instantiated in this context; do it.
787 Handle<Object> args[] = { data }; 788 Handle<Object> args[] = { data };
788 Handle<Object> result = Call(isolate, 789 Handle<Object> result = Call(isolate,
789 isolate->instantiate_fun(), 790 isolate->instantiate_fun(),
790 isolate->js_builtins_object(), 791 isolate->js_builtins_object(),
791 ARRAY_SIZE(args), 792 ARRAY_SIZE(args),
792 args, 793 args,
793 exc); 794 exc);
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 if (stack_guard->IsInstallCodeRequest()) { 1013 if (stack_guard->IsInstallCodeRequest()) {
1013 ASSERT(isolate->concurrent_recompilation_enabled()); 1014 ASSERT(isolate->concurrent_recompilation_enabled());
1014 stack_guard->Continue(INSTALL_CODE); 1015 stack_guard->Continue(INSTALL_CODE);
1015 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions(); 1016 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions();
1016 } 1017 }
1017 isolate->runtime_profiler()->OptimizeNow(); 1018 isolate->runtime_profiler()->OptimizeNow();
1018 return isolate->heap()->undefined_value(); 1019 return isolate->heap()->undefined_value();
1019 } 1020 }
1020 1021
1021 } } // namespace v8::internal 1022 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/debug.cc ('k') | src/factory.cc » ('j') | src/objects.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698