| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 isolate_->heap()->SetStackLimits(); | 62 isolate_->heap()->SetStackLimits(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 | 65 |
| 66 static Handle<Object> Invoke(bool construct, | 66 static Handle<Object> Invoke(bool construct, |
| 67 Handle<JSFunction> func, | 67 Handle<JSFunction> func, |
| 68 Handle<Object> receiver, | 68 Handle<Object> receiver, |
| 69 int argc, | 69 int argc, |
| 70 Object*** args, | 70 Object*** args, |
| 71 bool* has_pending_exception) { | 71 bool* has_pending_exception) { |
| 72 Isolate* isolate = func->GetIsolate(); |
| 73 |
| 72 // Entering JavaScript. | 74 // Entering JavaScript. |
| 73 VMState state(JS); | 75 VMState state(JS); |
| 74 | 76 |
| 75 // Placeholder for return value. | 77 // Placeholder for return value. |
| 76 Object* value = reinterpret_cast<Object*>(kZapValue); | 78 Object* value = reinterpret_cast<Object*>(kZapValue); |
| 77 | 79 |
| 78 typedef Object* (*JSEntryFunction)( | 80 typedef Object* (*JSEntryFunction)( |
| 79 byte* entry, | 81 byte* entry, |
| 80 Object* function, | 82 Object* function, |
| 81 Object* receiver, | 83 Object* receiver, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 99 receiver = Handle<JSObject>(global->global_receiver()); | 101 receiver = Handle<JSObject>(global->global_receiver()); |
| 100 } | 102 } |
| 101 | 103 |
| 102 // Make sure that the global object of the context we're about to | 104 // Make sure that the global object of the context we're about to |
| 103 // make the current one is indeed a global object. | 105 // make the current one is indeed a global object. |
| 104 ASSERT(func->context()->global()->IsGlobalObject()); | 106 ASSERT(func->context()->global()->IsGlobalObject()); |
| 105 | 107 |
| 106 { | 108 { |
| 107 // Save and restore context around invocation and block the | 109 // Save and restore context around invocation and block the |
| 108 // allocation of handles without explicit handle scopes. | 110 // allocation of handles without explicit handle scopes. |
| 109 SaveContext save; | 111 SaveContext save(isolate); |
| 110 NoHandleAllocation na; | 112 NoHandleAllocation na; |
| 111 JSEntryFunction entry = FUNCTION_CAST<JSEntryFunction>(code->entry()); | 113 JSEntryFunction entry = FUNCTION_CAST<JSEntryFunction>(code->entry()); |
| 112 | 114 |
| 113 // Call the function through the right JS entry stub. | 115 // Call the function through the right JS entry stub. |
| 114 byte* entry_address = func->code()->entry(); | 116 byte* entry_address = func->code()->entry(); |
| 115 JSFunction* function = *func; | 117 JSFunction* function = *func; |
| 116 Object* receiver_pointer = *receiver; | 118 Object* receiver_pointer = *receiver; |
| 117 value = CALL_GENERATED_CODE(entry, entry_address, function, | 119 value = CALL_GENERATED_CODE(entry, entry_address, function, |
| 118 receiver_pointer, argc, args); | 120 receiver_pointer, argc, args); |
| 119 } | 121 } |
| 120 | 122 |
| 121 #ifdef DEBUG | 123 #ifdef DEBUG |
| 122 value->Verify(); | 124 value->Verify(); |
| 123 #endif | 125 #endif |
| 124 | 126 |
| 125 // Update the pending exception flag and return the value. | 127 // Update the pending exception flag and return the value. |
| 126 *has_pending_exception = value->IsException(); | 128 *has_pending_exception = value->IsException(); |
| 127 ASSERT(*has_pending_exception == Isolate::Current()->has_pending_exception()); | 129 ASSERT(*has_pending_exception == Isolate::Current()->has_pending_exception()); |
| 128 if (*has_pending_exception) { | 130 if (*has_pending_exception) { |
| 129 Isolate::Current()->ReportPendingMessages(); | 131 isolate->ReportPendingMessages(); |
| 130 return Handle<Object>(); | 132 return Handle<Object>(); |
| 131 } else { | 133 } else { |
| 132 Isolate::Current()->clear_pending_message(); | 134 isolate->clear_pending_message(); |
| 133 } | 135 } |
| 134 | 136 |
| 135 return Handle<Object>(value); | 137 return Handle<Object>(value, isolate); |
| 136 } | 138 } |
| 137 | 139 |
| 138 | 140 |
| 139 Handle<Object> Execution::Call(Handle<JSFunction> func, | 141 Handle<Object> Execution::Call(Handle<JSFunction> func, |
| 140 Handle<Object> receiver, | 142 Handle<Object> receiver, |
| 141 int argc, | 143 int argc, |
| 142 Object*** args, | 144 Object*** args, |
| 143 bool* pending_exception) { | 145 bool* pending_exception) { |
| 144 return Invoke(false, func, receiver, argc, args, pending_exception); | 146 return Invoke(false, func, receiver, argc, args, pending_exception); |
| 145 } | 147 } |
| (...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 return Utils::OpenHandle(*args[0].As<v8::String>())->IsAsciiRepresentation() ? | 854 return Utils::OpenHandle(*args[0].As<v8::String>())->IsAsciiRepresentation() ? |
| 853 v8::True() : v8::False(); | 855 v8::True() : v8::False(); |
| 854 } | 856 } |
| 855 | 857 |
| 856 | 858 |
| 857 static ExternalizeStringExtension externalize_extension; | 859 static ExternalizeStringExtension externalize_extension; |
| 858 static v8::DeclareExtension externalize_extension_declaration( | 860 static v8::DeclareExtension externalize_extension_declaration( |
| 859 &externalize_extension); | 861 &externalize_extension); |
| 860 | 862 |
| 861 } } // namespace v8::internal | 863 } } // namespace v8::internal |
| OLD | NEW |