| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 #endif // ENABLE_DEBUGGER_SUPPORT | 141 #endif // ENABLE_DEBUGGER_SUPPORT |
| 142 return Handle<Object>(); | 142 return Handle<Object>(); |
| 143 } else { | 143 } else { |
| 144 isolate->clear_pending_message(); | 144 isolate->clear_pending_message(); |
| 145 } | 145 } |
| 146 | 146 |
| 147 return Handle<Object>(value->ToObjectUnchecked(), isolate); | 147 return Handle<Object>(value->ToObjectUnchecked(), isolate); |
| 148 } | 148 } |
| 149 | 149 |
| 150 | 150 |
| 151 Handle<Object> Execution::Call(Handle<Object> callable, | 151 Handle<Object> Execution::Call(Isolate* isolate, |
| 152 Handle<Object> callable, |
| 152 Handle<Object> receiver, | 153 Handle<Object> receiver, |
| 153 int argc, | 154 int argc, |
| 154 Handle<Object> argv[], | 155 Handle<Object> argv[], |
| 155 bool* pending_exception, | 156 bool* pending_exception, |
| 156 bool convert_receiver) { | 157 bool convert_receiver) { |
| 157 *pending_exception = false; | 158 *pending_exception = false; |
| 158 | 159 |
| 159 Isolate* isolate = Isolate::Current(); | |
| 160 if (!callable->IsJSFunction()) { | 160 if (!callable->IsJSFunction()) { |
| 161 callable = TryGetFunctionDelegate(isolate, callable, pending_exception); | 161 callable = TryGetFunctionDelegate(isolate, callable, pending_exception); |
| 162 if (*pending_exception) return callable; | 162 if (*pending_exception) return callable; |
| 163 } | 163 } |
| 164 Handle<JSFunction> func = Handle<JSFunction>::cast(callable); | 164 Handle<JSFunction> func = Handle<JSFunction>::cast(callable); |
| 165 | 165 |
| 166 // In non-strict mode, convert receiver. | 166 // In non-strict mode, convert receiver. |
| 167 if (convert_receiver && !receiver->IsJSReceiver() && | 167 if (convert_receiver && !receiver->IsJSReceiver() && |
| 168 !func->shared()->native() && func->shared()->is_classic_mode()) { | 168 !func->shared()->native() && func->shared()->is_classic_mode()) { |
| 169 if (receiver->IsUndefined() || receiver->IsNull()) { | 169 if (receiver->IsUndefined() || receiver->IsNull()) { |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 } | 592 } |
| 593 } | 593 } |
| 594 | 594 |
| 595 | 595 |
| 596 // --- C a l l s t o n a t i v e s --- | 596 // --- C a l l s t o n a t i v e s --- |
| 597 | 597 |
| 598 #define RETURN_NATIVE_CALL(name, args, has_pending_exception) \ | 598 #define RETURN_NATIVE_CALL(name, args, has_pending_exception) \ |
| 599 do { \ | 599 do { \ |
| 600 Handle<Object> argv[] = args; \ | 600 Handle<Object> argv[] = args; \ |
| 601 ASSERT(has_pending_exception != NULL); \ | 601 ASSERT(has_pending_exception != NULL); \ |
| 602 return Call(isolate->name##_fun(), \ | 602 return Call(isolate, \ |
| 603 isolate->name##_fun(), \ |
| 603 isolate->js_builtins_object(), \ | 604 isolate->js_builtins_object(), \ |
| 604 ARRAY_SIZE(argv), argv, \ | 605 ARRAY_SIZE(argv), argv, \ |
| 605 has_pending_exception); \ | 606 has_pending_exception); \ |
| 606 } while (false) | 607 } while (false) |
| 607 | 608 |
| 608 | 609 |
| 609 Handle<Object> Execution::ToNumber( | 610 Handle<Object> Execution::ToNumber( |
| 610 Isolate* isolate, Handle<Object> obj, bool* exc) { | 611 Isolate* isolate, Handle<Object> obj, bool* exc) { |
| 611 RETURN_NATIVE_CALL(to_number, { obj }, exc); | 612 RETURN_NATIVE_CALL(to_number, { obj }, exc); |
| 612 } | 613 } |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 bool* exc) { | 706 bool* exc) { |
| 706 Isolate* isolate = data->GetIsolate(); | 707 Isolate* isolate = data->GetIsolate(); |
| 707 // Fast case: see if the function has already been instantiated | 708 // Fast case: see if the function has already been instantiated |
| 708 int serial_number = Smi::cast(data->serial_number())->value(); | 709 int serial_number = Smi::cast(data->serial_number())->value(); |
| 709 Object* elm = | 710 Object* elm = |
| 710 isolate->native_context()->function_cache()-> | 711 isolate->native_context()->function_cache()-> |
| 711 GetElementNoExceptionThrown(isolate, serial_number); | 712 GetElementNoExceptionThrown(isolate, serial_number); |
| 712 if (elm->IsJSFunction()) return Handle<JSFunction>(JSFunction::cast(elm)); | 713 if (elm->IsJSFunction()) return Handle<JSFunction>(JSFunction::cast(elm)); |
| 713 // The function has not yet been instantiated in this context; do it. | 714 // The function has not yet been instantiated in this context; do it. |
| 714 Handle<Object> args[] = { data }; | 715 Handle<Object> args[] = { data }; |
| 715 Handle<Object> result = Call(isolate->instantiate_fun(), | 716 Handle<Object> result = Call(isolate, |
| 717 isolate->instantiate_fun(), |
| 716 isolate->js_builtins_object(), | 718 isolate->js_builtins_object(), |
| 717 ARRAY_SIZE(args), | 719 ARRAY_SIZE(args), |
| 718 args, | 720 args, |
| 719 exc); | 721 exc); |
| 720 if (*exc) return Handle<JSFunction>::null(); | 722 if (*exc) return Handle<JSFunction>::null(); |
| 721 return Handle<JSFunction>::cast(result); | 723 return Handle<JSFunction>::cast(result); |
| 722 } | 724 } |
| 723 | 725 |
| 724 | 726 |
| 725 Handle<JSObject> Execution::InstantiateObject(Handle<ObjectTemplateInfo> data, | 727 Handle<JSObject> Execution::InstantiateObject(Handle<ObjectTemplateInfo> data, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 737 Handle<JSFunction> cons = InstantiateFunction(cons_template, exc); | 739 Handle<JSFunction> cons = InstantiateFunction(cons_template, exc); |
| 738 if (*exc) return Handle<JSObject>::null(); | 740 if (*exc) return Handle<JSObject>::null(); |
| 739 Handle<Object> value = New(cons, 0, NULL, exc); | 741 Handle<Object> value = New(cons, 0, NULL, exc); |
| 740 if (*exc) return Handle<JSObject>::null(); | 742 if (*exc) return Handle<JSObject>::null(); |
| 741 result = *value; | 743 result = *value; |
| 742 } | 744 } |
| 743 ASSERT(!*exc); | 745 ASSERT(!*exc); |
| 744 return Handle<JSObject>(JSObject::cast(result)); | 746 return Handle<JSObject>(JSObject::cast(result)); |
| 745 } else { | 747 } else { |
| 746 Handle<Object> args[] = { data }; | 748 Handle<Object> args[] = { data }; |
| 747 Handle<Object> result = Call(isolate->instantiate_fun(), | 749 Handle<Object> result = Call(isolate, |
| 750 isolate->instantiate_fun(), |
| 748 isolate->js_builtins_object(), | 751 isolate->js_builtins_object(), |
| 749 ARRAY_SIZE(args), | 752 ARRAY_SIZE(args), |
| 750 args, | 753 args, |
| 751 exc); | 754 exc); |
| 752 if (*exc) return Handle<JSObject>::null(); | 755 if (*exc) return Handle<JSObject>::null(); |
| 753 return Handle<JSObject>::cast(result); | 756 return Handle<JSObject>::cast(result); |
| 754 } | 757 } |
| 755 } | 758 } |
| 756 | 759 |
| 757 | 760 |
| 758 void Execution::ConfigureInstance(Isolate* isolate, | 761 void Execution::ConfigureInstance(Isolate* isolate, |
| 759 Handle<Object> instance, | 762 Handle<Object> instance, |
| 760 Handle<Object> instance_template, | 763 Handle<Object> instance_template, |
| 761 bool* exc) { | 764 bool* exc) { |
| 762 Handle<Object> args[] = { instance, instance_template }; | 765 Handle<Object> args[] = { instance, instance_template }; |
| 763 Execution::Call(isolate->configure_instance_fun(), | 766 Execution::Call(isolate, |
| 767 isolate->configure_instance_fun(), |
| 764 isolate->js_builtins_object(), | 768 isolate->js_builtins_object(), |
| 765 ARRAY_SIZE(args), | 769 ARRAY_SIZE(args), |
| 766 args, | 770 args, |
| 767 exc); | 771 exc); |
| 768 } | 772 } |
| 769 | 773 |
| 770 | 774 |
| 771 Handle<String> Execution::GetStackTraceLine(Handle<Object> recv, | 775 Handle<String> Execution::GetStackTraceLine(Handle<Object> recv, |
| 772 Handle<JSFunction> fun, | 776 Handle<JSFunction> fun, |
| 773 Handle<Object> pos, | 777 Handle<Object> pos, |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 } | 931 } |
| 928 if (stack_guard->IsFullDeopt()) { | 932 if (stack_guard->IsFullDeopt()) { |
| 929 stack_guard->Continue(FULL_DEOPT); | 933 stack_guard->Continue(FULL_DEOPT); |
| 930 Deoptimizer::DeoptimizeAll(isolate); | 934 Deoptimizer::DeoptimizeAll(isolate); |
| 931 } | 935 } |
| 932 return isolate->heap()->undefined_value(); | 936 return isolate->heap()->undefined_value(); |
| 933 } | 937 } |
| 934 | 938 |
| 935 | 939 |
| 936 } } // namespace v8::internal | 940 } } // namespace v8::internal |
| OLD | NEW |