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

Side by Side Diff: src/execution.cc

Issue 8133020: Simplify calling generated code from the runtime. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 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/execution.h ('k') | src/factory.cc » ('j') | src/ic.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 60
61 void StackGuard::reset_limits(const ExecutionAccess& lock) { 61 void StackGuard::reset_limits(const ExecutionAccess& lock) {
62 ASSERT(isolate_ != NULL); 62 ASSERT(isolate_ != NULL);
63 thread_local_.jslimit_ = thread_local_.real_jslimit_; 63 thread_local_.jslimit_ = thread_local_.real_jslimit_;
64 thread_local_.climit_ = thread_local_.real_climit_; 64 thread_local_.climit_ = thread_local_.real_climit_;
65 isolate_->heap()->SetStackLimits(); 65 isolate_->heap()->SetStackLimits();
66 } 66 }
67 67
68 68
69 static Handle<Object> Invoke(bool construct, 69 static Handle<Object> Invoke(bool is_construct,
70 Handle<JSFunction> func, 70 Handle<JSFunction> function,
71 Handle<Object> receiver, 71 Handle<Object> receiver,
72 int argc, 72 int argc,
73 Object*** args, 73 Handle<Object> args[],
74 bool* has_pending_exception) { 74 bool* has_pending_exception) {
75 Isolate* isolate = func->GetIsolate(); 75 Isolate* isolate = function->GetIsolate();
76 76
77 // Entering JavaScript. 77 // Entering JavaScript.
78 VMState state(isolate, JS); 78 VMState state(isolate, JS);
79 79
80 // Placeholder for return value. 80 // Placeholder for return value.
81 MaybeObject* value = reinterpret_cast<Object*>(kZapValue); 81 MaybeObject* value = reinterpret_cast<Object*>(kZapValue);
82 82
83 typedef Object* (*JSEntryFunction)( 83 typedef Object* (*JSEntryFunction)(byte* entry,
84 byte* entry, 84 Object* function,
85 Object* function, 85 Object* receiver,
86 Object* receiver, 86 int argc,
87 int argc, 87 Object*** args);
88 Object*** args);
89 88
90 Handle<Code> code; 89 Handle<Code> code = is_construct
91 if (construct) { 90 ? isolate->factory()->js_construct_entry_code()
92 code = isolate->factory()->js_construct_entry_code(); 91 : isolate->factory()->js_entry_code();
93 } else {
94 code = isolate->factory()->js_entry_code();
95 }
96 92
97 // Convert calls on global objects to be calls on the global 93 // Convert calls on global objects to be calls on the global
98 // receiver instead to avoid having a 'this' pointer which refers 94 // receiver instead to avoid having a 'this' pointer which refers
99 // directly to a global object. 95 // directly to a global object.
100 if (receiver->IsGlobalObject()) { 96 if (receiver->IsGlobalObject()) {
101 Handle<GlobalObject> global = Handle<GlobalObject>::cast(receiver); 97 Handle<GlobalObject> global = Handle<GlobalObject>::cast(receiver);
102 receiver = Handle<JSObject>(global->global_receiver()); 98 receiver = Handle<JSObject>(global->global_receiver());
103 } 99 }
104 100
105 // Make sure that the global object of the context we're about to 101 // Make sure that the global object of the context we're about to
106 // make the current one is indeed a global object. 102 // make the current one is indeed a global object.
107 ASSERT(func->context()->global()->IsGlobalObject()); 103 ASSERT(function->context()->global()->IsGlobalObject());
108 104
109 { 105 {
110 // Save and restore context around invocation and block the 106 // Save and restore context around invocation and block the
111 // allocation of handles without explicit handle scopes. 107 // allocation of handles without explicit handle scopes.
112 SaveContext save(isolate); 108 SaveContext save(isolate);
113 NoHandleAllocation na; 109 NoHandleAllocation na;
114 JSEntryFunction entry = FUNCTION_CAST<JSEntryFunction>(code->entry()); 110 JSEntryFunction stub_entry = FUNCTION_CAST<JSEntryFunction>(code->entry());
115 111
116 // Call the function through the right JS entry stub. 112 // Call the function through the right JS entry stub.
117 byte* entry_address = func->code()->entry(); 113 byte* function_entry = function->code()->entry();
118 JSFunction* function = *func; 114 JSFunction* func = *function;
119 Object* receiver_pointer = *receiver; 115 Object* recv = *receiver;
120 value = CALL_GENERATED_CODE(entry, entry_address, function, 116 Object*** argv = reinterpret_cast<Object***>(args);
121 receiver_pointer, argc, args); 117 value =
118 CALL_GENERATED_CODE(stub_entry, function_entry, func, recv, argc, argv);
122 } 119 }
123 120
124 #ifdef DEBUG 121 #ifdef DEBUG
125 value->Verify(); 122 value->Verify();
126 #endif 123 #endif
127 124
128 // Update the pending exception flag and return the value. 125 // Update the pending exception flag and return the value.
129 *has_pending_exception = value->IsException(); 126 *has_pending_exception = value->IsException();
130 ASSERT(*has_pending_exception == Isolate::Current()->has_pending_exception()); 127 ASSERT(*has_pending_exception == Isolate::Current()->has_pending_exception());
131 if (*has_pending_exception) { 128 if (*has_pending_exception) {
132 isolate->ReportPendingMessages(); 129 isolate->ReportPendingMessages();
133 if (isolate->pending_exception() == Failure::OutOfMemoryException()) { 130 if (isolate->pending_exception() == Failure::OutOfMemoryException()) {
134 if (!isolate->ignore_out_of_memory()) { 131 if (!isolate->ignore_out_of_memory()) {
135 V8::FatalProcessOutOfMemory("JS", true); 132 V8::FatalProcessOutOfMemory("JS", true);
136 } 133 }
137 } 134 }
138 return Handle<Object>(); 135 return Handle<Object>();
139 } else { 136 } else {
140 isolate->clear_pending_message(); 137 isolate->clear_pending_message();
141 } 138 }
142 139
143 return Handle<Object>(value->ToObjectUnchecked(), isolate); 140 return Handle<Object>(value->ToObjectUnchecked(), isolate);
144 } 141 }
145 142
146 143
147 Handle<Object> Execution::Call(Handle<Object> callable, 144 Handle<Object> Execution::Call(Handle<Object> callable,
148 Handle<Object> receiver, 145 Handle<Object> receiver,
149 int argc, 146 int argc,
150 Object*** args, 147 Handle<Object> argv[],
151 bool* pending_exception, 148 bool* pending_exception,
152 bool convert_receiver) { 149 bool convert_receiver) {
153 *pending_exception = false; 150 *pending_exception = false;
154 151
155 if (!callable->IsJSFunction()) { 152 if (!callable->IsJSFunction()) {
156 callable = TryGetFunctionDelegate(callable, pending_exception); 153 callable = TryGetFunctionDelegate(callable, pending_exception);
157 if (*pending_exception) return callable; 154 if (*pending_exception) return callable;
158 } 155 }
159 Handle<JSFunction> func = Handle<JSFunction>::cast(callable); 156 Handle<JSFunction> func = Handle<JSFunction>::cast(callable);
160 157
161 // In non-strict mode, convert receiver. 158 // In non-strict mode, convert receiver.
162 if (convert_receiver && !receiver->IsJSReceiver() && 159 if (convert_receiver && !receiver->IsJSReceiver() &&
163 !func->shared()->native() && !func->shared()->strict_mode()) { 160 !func->shared()->native() && !func->shared()->strict_mode()) {
164 if (receiver->IsUndefined() || receiver->IsNull()) { 161 if (receiver->IsUndefined() || receiver->IsNull()) {
165 Object* global = func->context()->global()->global_receiver(); 162 Object* global = func->context()->global()->global_receiver();
166 // Under some circumstances, 'global' can be the JSBuiltinsObject 163 // Under some circumstances, 'global' can be the JSBuiltinsObject
167 // In that case, don't rewrite. 164 // In that case, don't rewrite.
168 // (FWIW, the same holds for GetIsolate()->global()->global_receiver().) 165 // (FWIW, the same holds for GetIsolate()->global()->global_receiver().)
169 if (!global->IsJSBuiltinsObject()) receiver = Handle<Object>(global); 166 if (!global->IsJSBuiltinsObject()) receiver = Handle<Object>(global);
170 } else { 167 } else {
171 receiver = ToObject(receiver, pending_exception); 168 receiver = ToObject(receiver, pending_exception);
172 } 169 }
173 if (*pending_exception) return callable; 170 if (*pending_exception) return callable;
174 } 171 }
175 172
176 return Invoke(false, func, receiver, argc, args, pending_exception); 173 return Invoke(false, func, receiver, argc, argv, pending_exception);
177 } 174 }
178 175
179 176
180 Handle<Object> Execution::New(Handle<JSFunction> func, int argc, 177 Handle<Object> Execution::New(Handle<JSFunction> func,
181 Object*** args, bool* pending_exception) { 178 int argc,
182 return Invoke(true, func, Isolate::Current()->global(), argc, args, 179 Handle<Object> argv[],
180 bool* pending_exception) {
181 return Invoke(true, func, Isolate::Current()->global(), argc, argv,
183 pending_exception); 182 pending_exception);
184 } 183 }
185 184
186 185
187 Handle<Object> Execution::TryCall(Handle<JSFunction> func, 186 Handle<Object> Execution::TryCall(Handle<JSFunction> func,
188 Handle<Object> receiver, 187 Handle<Object> receiver,
189 int argc, 188 int argc,
190 Object*** args, 189 Handle<Object> args[],
191 bool* caught_exception) { 190 bool* caught_exception) {
192 // Enter a try-block while executing the JavaScript code. To avoid 191 // Enter a try-block while executing the JavaScript code. To avoid
193 // duplicate error printing it must be non-verbose. Also, to avoid 192 // duplicate error printing it must be non-verbose. Also, to avoid
194 // creating message objects during stack overflow we shouldn't 193 // creating message objects during stack overflow we shouldn't
195 // capture messages. 194 // capture messages.
196 v8::TryCatch catcher; 195 v8::TryCatch catcher;
197 catcher.SetVerbose(false); 196 catcher.SetVerbose(false);
198 catcher.SetCaptureMessage(false); 197 catcher.SetCaptureMessage(false);
199 *caught_exception = false; 198 *caught_exception = false;
200 199
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 uintptr_t stored_limit = per_thread->stack_limit(); 565 uintptr_t stored_limit = per_thread->stack_limit();
567 // You should hold the ExecutionAccess lock when you call this. 566 // You should hold the ExecutionAccess lock when you call this.
568 if (stored_limit != 0) { 567 if (stored_limit != 0) {
569 SetStackLimit(stored_limit); 568 SetStackLimit(stored_limit);
570 } 569 }
571 } 570 }
572 571
573 572
574 // --- C a l l s t o n a t i v e s --- 573 // --- C a l l s t o n a t i v e s ---
575 574
576 #define RETURN_NATIVE_CALL(name, argc, argv, has_pending_exception) \ 575 #define RETURN_NATIVE_CALL(name, args, has_pending_exception) \
577 do { \ 576 do { \
578 Isolate* isolate = Isolate::Current(); \ 577 Isolate* isolate = Isolate::Current(); \
579 Object** args[argc] = argv; \ 578 Handle<Object> argv[] = args; \
580 ASSERT(has_pending_exception != NULL); \ 579 ASSERT(has_pending_exception != NULL); \
581 return Call(isolate->name##_fun(), \ 580 return Call(isolate->name##_fun(), \
582 isolate->js_builtins_object(), argc, args, \ 581 isolate->js_builtins_object(), \
583 has_pending_exception); \ 582 ARRAY_SIZE(argv), argv, \
rossberg 2011/10/05 13:10:17 I guess it doesn't matter much, because the macro
Kevin Millikin (Chromium) 2011/10/05 13:47:26 Yeah, it's a bit dangerous and the programmer has
583 has_pending_exception); \
584 } while (false) 584 } while (false)
585 585
586 586
587 Handle<Object> Execution::ToBoolean(Handle<Object> obj) { 587 Handle<Object> Execution::ToBoolean(Handle<Object> obj) {
588 // See the similar code in runtime.js:ToBoolean. 588 // See the similar code in runtime.js:ToBoolean.
589 if (obj->IsBoolean()) return obj; 589 if (obj->IsBoolean()) return obj;
590 bool result = true; 590 bool result = true;
591 if (obj->IsString()) { 591 if (obj->IsString()) {
592 result = Handle<String>::cast(obj)->length() != 0; 592 result = Handle<String>::cast(obj)->length() != 0;
593 } else if (obj->IsNull() || obj->IsUndefined()) { 593 } else if (obj->IsNull() || obj->IsUndefined()) {
594 result = false; 594 result = false;
595 } else if (obj->IsNumber()) { 595 } else if (obj->IsNumber()) {
596 double value = obj->Number(); 596 double value = obj->Number();
597 result = !((value == 0) || isnan(value)); 597 result = !((value == 0) || isnan(value));
598 } 598 }
599 return Handle<Object>(HEAP->ToBoolean(result)); 599 return Handle<Object>(HEAP->ToBoolean(result));
600 } 600 }
601 601
602 602
603 Handle<Object> Execution::ToNumber(Handle<Object> obj, bool* exc) { 603 Handle<Object> Execution::ToNumber(Handle<Object> obj, bool* exc) {
604 RETURN_NATIVE_CALL(to_number, 1, { obj.location() }, exc); 604 RETURN_NATIVE_CALL(to_number, { obj }, exc);
605 } 605 }
606 606
607 607
608 Handle<Object> Execution::ToString(Handle<Object> obj, bool* exc) { 608 Handle<Object> Execution::ToString(Handle<Object> obj, bool* exc) {
609 RETURN_NATIVE_CALL(to_string, 1, { obj.location() }, exc); 609 RETURN_NATIVE_CALL(to_string, { obj }, exc);
610 } 610 }
611 611
612 612
613 Handle<Object> Execution::ToDetailString(Handle<Object> obj, bool* exc) { 613 Handle<Object> Execution::ToDetailString(Handle<Object> obj, bool* exc) {
614 RETURN_NATIVE_CALL(to_detail_string, 1, { obj.location() }, exc); 614 RETURN_NATIVE_CALL(to_detail_string, { obj }, exc);
615 } 615 }
616 616
617 617
618 Handle<Object> Execution::ToObject(Handle<Object> obj, bool* exc) { 618 Handle<Object> Execution::ToObject(Handle<Object> obj, bool* exc) {
619 if (obj->IsSpecObject()) return obj; 619 if (obj->IsSpecObject()) return obj;
620 RETURN_NATIVE_CALL(to_object, 1, { obj.location() }, exc); 620 RETURN_NATIVE_CALL(to_object, { obj }, exc);
621 } 621 }
622 622
623 623
624 Handle<Object> Execution::ToInteger(Handle<Object> obj, bool* exc) { 624 Handle<Object> Execution::ToInteger(Handle<Object> obj, bool* exc) {
625 RETURN_NATIVE_CALL(to_integer, 1, { obj.location() }, exc); 625 RETURN_NATIVE_CALL(to_integer, { obj }, exc);
626 } 626 }
627 627
628 628
629 Handle<Object> Execution::ToUint32(Handle<Object> obj, bool* exc) { 629 Handle<Object> Execution::ToUint32(Handle<Object> obj, bool* exc) {
630 RETURN_NATIVE_CALL(to_uint32, 1, { obj.location() }, exc); 630 RETURN_NATIVE_CALL(to_uint32, { obj }, exc);
631 } 631 }
632 632
633 633
634 Handle<Object> Execution::ToInt32(Handle<Object> obj, bool* exc) { 634 Handle<Object> Execution::ToInt32(Handle<Object> obj, bool* exc) {
635 RETURN_NATIVE_CALL(to_int32, 1, { obj.location() }, exc); 635 RETURN_NATIVE_CALL(to_int32, { obj }, exc);
636 } 636 }
637 637
638 638
639 Handle<Object> Execution::NewDate(double time, bool* exc) { 639 Handle<Object> Execution::NewDate(double time, bool* exc) {
640 Handle<Object> time_obj = FACTORY->NewNumber(time); 640 Handle<Object> time_obj = FACTORY->NewNumber(time);
641 RETURN_NATIVE_CALL(create_date, 1, { time_obj.location() }, exc); 641 RETURN_NATIVE_CALL(create_date, { time_obj }, exc);
642 } 642 }
643 643
644 644
645 #undef RETURN_NATIVE_CALL 645 #undef RETURN_NATIVE_CALL
646 646
647 647
648 Handle<JSRegExp> Execution::NewJSRegExp(Handle<String> pattern, 648 Handle<JSRegExp> Execution::NewJSRegExp(Handle<String> pattern,
649 Handle<String> flags, 649 Handle<String> flags,
650 bool* exc) { 650 bool* exc) {
651 Handle<JSFunction> function = Handle<JSFunction>( 651 Handle<JSFunction> function = Handle<JSFunction>(
(...skipping 16 matching lines...) Expand all
668 668
669 Handle<Object> char_at = 669 Handle<Object> char_at =
670 GetProperty(isolate->js_builtins_object(), 670 GetProperty(isolate->js_builtins_object(),
671 factory->char_at_symbol()); 671 factory->char_at_symbol());
672 if (!char_at->IsJSFunction()) { 672 if (!char_at->IsJSFunction()) {
673 return factory->undefined_value(); 673 return factory->undefined_value();
674 } 674 }
675 675
676 bool caught_exception; 676 bool caught_exception;
677 Handle<Object> index_object = factory->NewNumberFromInt(int_index); 677 Handle<Object> index_object = factory->NewNumberFromInt(int_index);
678 Object** index_arg[] = { index_object.location() }; 678 Handle<Object> index_arg[] = { index_object };
679 Handle<Object> result = TryCall(Handle<JSFunction>::cast(char_at), 679 Handle<Object> result = TryCall(Handle<JSFunction>::cast(char_at),
680 string, 680 string,
681 ARRAY_SIZE(index_arg), 681 ARRAY_SIZE(index_arg),
682 index_arg, 682 index_arg,
683 &caught_exception); 683 &caught_exception);
684 if (caught_exception) { 684 if (caught_exception) {
685 return factory->undefined_value(); 685 return factory->undefined_value();
686 } 686 }
687 return result; 687 return result;
688 } 688 }
689 689
690 690
691 Handle<JSFunction> Execution::InstantiateFunction( 691 Handle<JSFunction> Execution::InstantiateFunction(
692 Handle<FunctionTemplateInfo> data, bool* exc) { 692 Handle<FunctionTemplateInfo> data,
693 bool* exc) {
693 Isolate* isolate = data->GetIsolate(); 694 Isolate* isolate = data->GetIsolate();
694 // Fast case: see if the function has already been instantiated 695 // Fast case: see if the function has already been instantiated
695 int serial_number = Smi::cast(data->serial_number())->value(); 696 int serial_number = Smi::cast(data->serial_number())->value();
696 Object* elm = 697 Object* elm =
697 isolate->global_context()->function_cache()-> 698 isolate->global_context()->function_cache()->
698 GetElementNoExceptionThrown(serial_number); 699 GetElementNoExceptionThrown(serial_number);
699 if (elm->IsJSFunction()) return Handle<JSFunction>(JSFunction::cast(elm)); 700 if (elm->IsJSFunction()) return Handle<JSFunction>(JSFunction::cast(elm));
700 // The function has not yet been instantiated in this context; do it. 701 // The function has not yet been instantiated in this context; do it.
701 Object** args[1] = { Handle<Object>::cast(data).location() }; 702 Handle<Object> args[] = { data };
702 Handle<Object> result = 703 Handle<Object> result = Call(isolate->instantiate_fun(),
703 Call(isolate->instantiate_fun(), 704 isolate->js_builtins_object(),
704 isolate->js_builtins_object(), 1, args, exc); 705 ARRAY_SIZE(args),
706 args,
707 exc);
705 if (*exc) return Handle<JSFunction>::null(); 708 if (*exc) return Handle<JSFunction>::null();
706 return Handle<JSFunction>::cast(result); 709 return Handle<JSFunction>::cast(result);
707 } 710 }
708 711
709 712
710 Handle<JSObject> Execution::InstantiateObject(Handle<ObjectTemplateInfo> data, 713 Handle<JSObject> Execution::InstantiateObject(Handle<ObjectTemplateInfo> data,
711 bool* exc) { 714 bool* exc) {
712 Isolate* isolate = data->GetIsolate(); 715 Isolate* isolate = data->GetIsolate();
713 if (data->property_list()->IsUndefined() && 716 if (data->property_list()->IsUndefined() &&
714 !data->constructor()->IsUndefined()) { 717 !data->constructor()->IsUndefined()) {
715 // Initialization to make gcc happy. 718 // Initialization to make gcc happy.
716 Object* result = NULL; 719 Object* result = NULL;
717 { 720 {
718 HandleScope scope(isolate); 721 HandleScope scope(isolate);
719 Handle<FunctionTemplateInfo> cons_template = 722 Handle<FunctionTemplateInfo> cons_template =
720 Handle<FunctionTemplateInfo>( 723 Handle<FunctionTemplateInfo>(
721 FunctionTemplateInfo::cast(data->constructor())); 724 FunctionTemplateInfo::cast(data->constructor()));
722 Handle<JSFunction> cons = InstantiateFunction(cons_template, exc); 725 Handle<JSFunction> cons = InstantiateFunction(cons_template, exc);
723 if (*exc) return Handle<JSObject>::null(); 726 if (*exc) return Handle<JSObject>::null();
724 Handle<Object> value = New(cons, 0, NULL, exc); 727 Handle<Object> value = New(cons, 0, NULL, exc);
725 if (*exc) return Handle<JSObject>::null(); 728 if (*exc) return Handle<JSObject>::null();
726 result = *value; 729 result = *value;
727 } 730 }
728 ASSERT(!*exc); 731 ASSERT(!*exc);
729 return Handle<JSObject>(JSObject::cast(result)); 732 return Handle<JSObject>(JSObject::cast(result));
730 } else { 733 } else {
731 Object** args[1] = { Handle<Object>::cast(data).location() }; 734 Handle<Object> args[] = { data };
732 Handle<Object> result = 735 Handle<Object> result = Call(isolate->instantiate_fun(),
733 Call(isolate->instantiate_fun(), 736 isolate->js_builtins_object(),
734 isolate->js_builtins_object(), 1, args, exc); 737 ARRAY_SIZE(args),
738 args,
739 exc);
735 if (*exc) return Handle<JSObject>::null(); 740 if (*exc) return Handle<JSObject>::null();
736 return Handle<JSObject>::cast(result); 741 return Handle<JSObject>::cast(result);
737 } 742 }
738 } 743 }
739 744
740 745
741 void Execution::ConfigureInstance(Handle<Object> instance, 746 void Execution::ConfigureInstance(Handle<Object> instance,
742 Handle<Object> instance_template, 747 Handle<Object> instance_template,
743 bool* exc) { 748 bool* exc) {
744 Isolate* isolate = Isolate::Current(); 749 Isolate* isolate = Isolate::Current();
745 Object** args[2] = { instance.location(), instance_template.location() }; 750 Handle<Object> args[] = { instance, instance_template };
746 Execution::Call(isolate->configure_instance_fun(), 751 Execution::Call(isolate->configure_instance_fun(),
747 isolate->js_builtins_object(), 2, args, exc); 752 isolate->js_builtins_object(),
753 ARRAY_SIZE(args),
754 args,
755 exc);
748 } 756 }
749 757
750 758
751 Handle<String> Execution::GetStackTraceLine(Handle<Object> recv, 759 Handle<String> Execution::GetStackTraceLine(Handle<Object> recv,
752 Handle<JSFunction> fun, 760 Handle<JSFunction> fun,
753 Handle<Object> pos, 761 Handle<Object> pos,
754 Handle<Object> is_global) { 762 Handle<Object> is_global) {
755 Isolate* isolate = fun->GetIsolate(); 763 Isolate* isolate = fun->GetIsolate();
756 const int argc = 4; 764 Handle<Object> args[] = { recv, fun, pos, is_global };
757 Object** args[argc] = { recv.location(),
758 Handle<Object>::cast(fun).location(),
759 pos.location(),
760 is_global.location() };
761 bool caught_exception; 765 bool caught_exception;
762 Handle<Object> result = 766 Handle<Object> result = TryCall(isolate->get_stack_trace_line_fun(),
763 TryCall(isolate->get_stack_trace_line_fun(), 767 isolate->js_builtins_object(),
764 isolate->js_builtins_object(), argc, args, 768 ARRAY_SIZE(args),
765 &caught_exception); 769 args,
770 &caught_exception);
766 if (caught_exception || !result->IsString()) { 771 if (caught_exception || !result->IsString()) {
767 return isolate->factory()->empty_symbol(); 772 return isolate->factory()->empty_symbol();
768 } 773 }
769 774
770 return Handle<String>::cast(result); 775 return Handle<String>::cast(result);
771 } 776 }
772 777
773 778
774 static Object* RuntimePreempt() { 779 static Object* RuntimePreempt() {
775 Isolate* isolate = Isolate::Current(); 780 Isolate* isolate = Isolate::Current();
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 return isolate->TerminateExecution(); 898 return isolate->TerminateExecution();
894 } 899 }
895 if (stack_guard->IsInterrupted()) { 900 if (stack_guard->IsInterrupted()) {
896 stack_guard->Continue(INTERRUPT); 901 stack_guard->Continue(INTERRUPT);
897 return isolate->StackOverflow(); 902 return isolate->StackOverflow();
898 } 903 }
899 return isolate->heap()->undefined_value(); 904 return isolate->heap()->undefined_value();
900 } 905 }
901 906
902 } } // namespace v8::internal 907 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/execution.h ('k') | src/factory.cc » ('j') | src/ic.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698