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 2603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2614 } | 2614 } |
2615 | 2615 |
2616 | 2616 |
2617 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsClassicModeFunction) { | 2617 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsClassicModeFunction) { |
2618 SealHandleScope shs(isolate); | 2618 SealHandleScope shs(isolate); |
2619 ASSERT(args.length() == 1); | 2619 ASSERT(args.length() == 1); |
2620 CONVERT_ARG_CHECKED(JSReceiver, callable, 0); | 2620 CONVERT_ARG_CHECKED(JSReceiver, callable, 0); |
2621 if (!callable->IsJSFunction()) { | 2621 if (!callable->IsJSFunction()) { |
2622 HandleScope scope(isolate); | 2622 HandleScope scope(isolate); |
2623 bool threw = false; | 2623 bool threw = false; |
2624 Handle<Object> delegate = | 2624 Handle<Object> delegate = Execution::TryGetFunctionDelegate( |
2625 Execution::TryGetFunctionDelegate(Handle<JSReceiver>(callable), &threw); | 2625 isolate, Handle<JSReceiver>(callable), &threw); |
2626 if (threw) return Failure::Exception(); | 2626 if (threw) return Failure::Exception(); |
2627 callable = JSFunction::cast(*delegate); | 2627 callable = JSFunction::cast(*delegate); |
2628 } | 2628 } |
2629 JSFunction* function = JSFunction::cast(callable); | 2629 JSFunction* function = JSFunction::cast(callable); |
2630 SharedFunctionInfo* shared = function->shared(); | 2630 SharedFunctionInfo* shared = function->shared(); |
2631 return isolate->heap()->ToBoolean(shared->is_classic_mode()); | 2631 return isolate->heap()->ToBoolean(shared->is_classic_mode()); |
2632 } | 2632 } |
2633 | 2633 |
2634 | 2634 |
2635 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetDefaultReceiver) { | 2635 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetDefaultReceiver) { |
2636 SealHandleScope shs(isolate); | 2636 SealHandleScope shs(isolate); |
2637 ASSERT(args.length() == 1); | 2637 ASSERT(args.length() == 1); |
2638 CONVERT_ARG_CHECKED(JSReceiver, callable, 0); | 2638 CONVERT_ARG_CHECKED(JSReceiver, callable, 0); |
2639 | 2639 |
2640 if (!callable->IsJSFunction()) { | 2640 if (!callable->IsJSFunction()) { |
2641 HandleScope scope(isolate); | 2641 HandleScope scope(isolate); |
2642 bool threw = false; | 2642 bool threw = false; |
2643 Handle<Object> delegate = | 2643 Handle<Object> delegate = Execution::TryGetFunctionDelegate( |
2644 Execution::TryGetFunctionDelegate(Handle<JSReceiver>(callable), &threw); | 2644 isolate, Handle<JSReceiver>(callable), &threw); |
2645 if (threw) return Failure::Exception(); | 2645 if (threw) return Failure::Exception(); |
2646 callable = JSFunction::cast(*delegate); | 2646 callable = JSFunction::cast(*delegate); |
2647 } | 2647 } |
2648 JSFunction* function = JSFunction::cast(callable); | 2648 JSFunction* function = JSFunction::cast(callable); |
2649 | 2649 |
2650 SharedFunctionInfo* shared = function->shared(); | 2650 SharedFunctionInfo* shared = function->shared(); |
2651 if (shared->native() || !shared->is_classic_mode()) { | 2651 if (shared->native() || !shared->is_classic_mode()) { |
2652 return isolate->heap()->undefined_value(); | 2652 return isolate->heap()->undefined_value(); |
2653 } | 2653 } |
2654 // Returns undefined for strict or native functions, or | 2654 // Returns undefined for strict or native functions, or |
(...skipping 2137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4792 return isolate->heap()->ToBoolean(object->HasElement(index)); | 4792 return isolate->heap()->ToBoolean(object->HasElement(index)); |
4793 } | 4793 } |
4794 | 4794 |
4795 // Convert the key to a name - possibly by calling back into JavaScript. | 4795 // Convert the key to a name - possibly by calling back into JavaScript. |
4796 Handle<Name> name; | 4796 Handle<Name> name; |
4797 if (key->IsName()) { | 4797 if (key->IsName()) { |
4798 name = Handle<Name>::cast(key); | 4798 name = Handle<Name>::cast(key); |
4799 } else { | 4799 } else { |
4800 bool has_pending_exception = false; | 4800 bool has_pending_exception = false; |
4801 Handle<Object> converted = | 4801 Handle<Object> converted = |
4802 Execution::ToString(key, &has_pending_exception); | 4802 Execution::ToString(isolate, key, &has_pending_exception); |
4803 if (has_pending_exception) return Failure::Exception(); | 4803 if (has_pending_exception) return Failure::Exception(); |
4804 name = Handle<Name>::cast(converted); | 4804 name = Handle<Name>::cast(converted); |
4805 } | 4805 } |
4806 | 4806 |
4807 return isolate->heap()->ToBoolean(object->HasProperty(*name)); | 4807 return isolate->heap()->ToBoolean(object->HasProperty(*name)); |
4808 } | 4808 } |
4809 | 4809 |
4810 MaybeObject* Runtime::GetObjectPropertyOrFail( | 4810 MaybeObject* Runtime::GetObjectPropertyOrFail( |
4811 Isolate* isolate, | 4811 Isolate* isolate, |
4812 Handle<Object> object, | 4812 Handle<Object> object, |
(...skipping 21 matching lines...) Expand all Loading... |
4834 return GetElementOrCharAt(isolate, object, index); | 4834 return GetElementOrCharAt(isolate, object, index); |
4835 } | 4835 } |
4836 | 4836 |
4837 // Convert the key to a name - possibly by calling back into JavaScript. | 4837 // Convert the key to a name - possibly by calling back into JavaScript. |
4838 Handle<Name> name; | 4838 Handle<Name> name; |
4839 if (key->IsName()) { | 4839 if (key->IsName()) { |
4840 name = Handle<Name>::cast(key); | 4840 name = Handle<Name>::cast(key); |
4841 } else { | 4841 } else { |
4842 bool has_pending_exception = false; | 4842 bool has_pending_exception = false; |
4843 Handle<Object> converted = | 4843 Handle<Object> converted = |
4844 Execution::ToString(key, &has_pending_exception); | 4844 Execution::ToString(isolate, key, &has_pending_exception); |
4845 if (has_pending_exception) return Failure::Exception(); | 4845 if (has_pending_exception) return Failure::Exception(); |
4846 name = Handle<Name>::cast(converted); | 4846 name = Handle<Name>::cast(converted); |
4847 } | 4847 } |
4848 | 4848 |
4849 // Check if the name is trivially convertible to an index and get | 4849 // Check if the name is trivially convertible to an index and get |
4850 // the element if so. | 4850 // the element if so. |
4851 if (name->AsArrayIndex(&index)) { | 4851 if (name->AsArrayIndex(&index)) { |
4852 return GetElementOrCharAt(isolate, object, index); | 4852 return GetElementOrCharAt(isolate, object, index); |
4853 } else { | 4853 } else { |
4854 return object->GetProperty(*name); | 4854 return object->GetProperty(*name); |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5132 Handle<Object> args[2] = { key, object }; | 5132 Handle<Object> args[2] = { key, object }; |
5133 Handle<Object> error = | 5133 Handle<Object> error = |
5134 isolate->factory()->NewTypeError("non_object_property_store", | 5134 isolate->factory()->NewTypeError("non_object_property_store", |
5135 HandleVector(args, 2)); | 5135 HandleVector(args, 2)); |
5136 return isolate->Throw(*error); | 5136 return isolate->Throw(*error); |
5137 } | 5137 } |
5138 | 5138 |
5139 if (object->IsJSProxy()) { | 5139 if (object->IsJSProxy()) { |
5140 bool has_pending_exception = false; | 5140 bool has_pending_exception = false; |
5141 Handle<Object> name = key->IsSymbol() | 5141 Handle<Object> name = key->IsSymbol() |
5142 ? key : Execution::ToString(key, &has_pending_exception); | 5142 ? key : Execution::ToString(isolate, key, &has_pending_exception); |
5143 if (has_pending_exception) return Failure::Exception(); | 5143 if (has_pending_exception) return Failure::Exception(); |
5144 return JSProxy::cast(*object)->SetProperty( | 5144 return JSProxy::cast(*object)->SetProperty( |
5145 Name::cast(*name), *value, attr, strict_mode); | 5145 Name::cast(*name), *value, attr, strict_mode); |
5146 } | 5146 } |
5147 | 5147 |
5148 // If the object isn't a JavaScript object, we ignore the store. | 5148 // If the object isn't a JavaScript object, we ignore the store. |
5149 if (!object->IsJSObject()) return *value; | 5149 if (!object->IsJSObject()) return *value; |
5150 | 5150 |
5151 Handle<JSObject> js_object = Handle<JSObject>::cast(object); | 5151 Handle<JSObject> js_object = Handle<JSObject>::cast(object); |
5152 | 5152 |
5153 // Check if the given key is an array index. | 5153 // Check if the given key is an array index. |
5154 uint32_t index; | 5154 uint32_t index; |
5155 if (key->ToArrayIndex(&index)) { | 5155 if (key->ToArrayIndex(&index)) { |
5156 // In Firefox/SpiderMonkey, Safari and Opera you can access the characters | 5156 // In Firefox/SpiderMonkey, Safari and Opera you can access the characters |
5157 // of a string using [] notation. We need to support this too in | 5157 // of a string using [] notation. We need to support this too in |
5158 // JavaScript. | 5158 // JavaScript. |
5159 // In the case of a String object we just need to redirect the assignment to | 5159 // In the case of a String object we just need to redirect the assignment to |
5160 // the underlying string if the index is in range. Since the underlying | 5160 // the underlying string if the index is in range. Since the underlying |
5161 // string does nothing with the assignment then we can ignore such | 5161 // string does nothing with the assignment then we can ignore such |
5162 // assignments. | 5162 // assignments. |
5163 if (js_object->IsStringObjectWithCharacterAt(index)) { | 5163 if (js_object->IsStringObjectWithCharacterAt(index)) { |
5164 return *value; | 5164 return *value; |
5165 } | 5165 } |
5166 | 5166 |
5167 js_object->ValidateElements(); | 5167 js_object->ValidateElements(); |
5168 if (js_object->HasExternalArrayElements()) { | 5168 if (js_object->HasExternalArrayElements()) { |
5169 if (!value->IsNumber() && !value->IsUndefined()) { | 5169 if (!value->IsNumber() && !value->IsUndefined()) { |
5170 bool has_exception; | 5170 bool has_exception; |
5171 Handle<Object> number = Execution::ToNumber(value, &has_exception); | 5171 Handle<Object> number = |
| 5172 Execution::ToNumber(isolate, value, &has_exception); |
5172 if (has_exception) return Failure::Exception(); | 5173 if (has_exception) return Failure::Exception(); |
5173 value = number; | 5174 value = number; |
5174 } | 5175 } |
5175 } | 5176 } |
5176 MaybeObject* result = js_object->SetElement( | 5177 MaybeObject* result = js_object->SetElement( |
5177 index, *value, attr, strict_mode, true, set_mode); | 5178 index, *value, attr, strict_mode, true, set_mode); |
5178 js_object->ValidateElements(); | 5179 js_object->ValidateElements(); |
5179 if (result->IsFailure()) return result; | 5180 if (result->IsFailure()) return result; |
5180 return *value; | 5181 return *value; |
5181 } | 5182 } |
5182 | 5183 |
5183 if (key->IsName()) { | 5184 if (key->IsName()) { |
5184 MaybeObject* result; | 5185 MaybeObject* result; |
5185 Handle<Name> name = Handle<Name>::cast(key); | 5186 Handle<Name> name = Handle<Name>::cast(key); |
5186 if (name->AsArrayIndex(&index)) { | 5187 if (name->AsArrayIndex(&index)) { |
5187 if (js_object->HasExternalArrayElements()) { | 5188 if (js_object->HasExternalArrayElements()) { |
5188 if (!value->IsNumber() && !value->IsUndefined()) { | 5189 if (!value->IsNumber() && !value->IsUndefined()) { |
5189 bool has_exception; | 5190 bool has_exception; |
5190 Handle<Object> number = Execution::ToNumber(value, &has_exception); | 5191 Handle<Object> number = |
| 5192 Execution::ToNumber(isolate, value, &has_exception); |
5191 if (has_exception) return Failure::Exception(); | 5193 if (has_exception) return Failure::Exception(); |
5192 value = number; | 5194 value = number; |
5193 } | 5195 } |
5194 } | 5196 } |
5195 result = js_object->SetElement( | 5197 result = js_object->SetElement( |
5196 index, *value, attr, strict_mode, true, set_mode); | 5198 index, *value, attr, strict_mode, true, set_mode); |
5197 } else { | 5199 } else { |
5198 if (name->IsString()) Handle<String>::cast(name)->TryFlatten(); | 5200 if (name->IsString()) Handle<String>::cast(name)->TryFlatten(); |
5199 result = js_object->SetProperty(*name, *value, attr, strict_mode); | 5201 result = js_object->SetProperty(*name, *value, attr, strict_mode); |
5200 } | 5202 } |
5201 if (result->IsFailure()) return result; | 5203 if (result->IsFailure()) return result; |
5202 return *value; | 5204 return *value; |
5203 } | 5205 } |
5204 | 5206 |
5205 // Call-back into JavaScript to convert the key to a string. | 5207 // Call-back into JavaScript to convert the key to a string. |
5206 bool has_pending_exception = false; | 5208 bool has_pending_exception = false; |
5207 Handle<Object> converted = Execution::ToString(key, &has_pending_exception); | 5209 Handle<Object> converted = |
| 5210 Execution::ToString(isolate, key, &has_pending_exception); |
5208 if (has_pending_exception) return Failure::Exception(); | 5211 if (has_pending_exception) return Failure::Exception(); |
5209 Handle<String> name = Handle<String>::cast(converted); | 5212 Handle<String> name = Handle<String>::cast(converted); |
5210 | 5213 |
5211 if (name->AsArrayIndex(&index)) { | 5214 if (name->AsArrayIndex(&index)) { |
5212 return js_object->SetElement( | 5215 return js_object->SetElement( |
5213 index, *value, attr, strict_mode, true, set_mode); | 5216 index, *value, attr, strict_mode, true, set_mode); |
5214 } else { | 5217 } else { |
5215 return js_object->SetProperty(*name, *value, attr, strict_mode); | 5218 return js_object->SetProperty(*name, *value, attr, strict_mode); |
5216 } | 5219 } |
5217 } | 5220 } |
(...skipping 30 matching lines...) Expand all Loading... |
5248 return js_object->SetElement( | 5251 return js_object->SetElement( |
5249 index, *value, attr, kNonStrictMode, false, DEFINE_PROPERTY); | 5252 index, *value, attr, kNonStrictMode, false, DEFINE_PROPERTY); |
5250 } else { | 5253 } else { |
5251 if (name->IsString()) Handle<String>::cast(name)->TryFlatten(); | 5254 if (name->IsString()) Handle<String>::cast(name)->TryFlatten(); |
5252 return js_object->SetLocalPropertyIgnoreAttributes(*name, *value, attr); | 5255 return js_object->SetLocalPropertyIgnoreAttributes(*name, *value, attr); |
5253 } | 5256 } |
5254 } | 5257 } |
5255 | 5258 |
5256 // Call-back into JavaScript to convert the key to a string. | 5259 // Call-back into JavaScript to convert the key to a string. |
5257 bool has_pending_exception = false; | 5260 bool has_pending_exception = false; |
5258 Handle<Object> converted = Execution::ToString(key, &has_pending_exception); | 5261 Handle<Object> converted = |
| 5262 Execution::ToString(isolate, key, &has_pending_exception); |
5259 if (has_pending_exception) return Failure::Exception(); | 5263 if (has_pending_exception) return Failure::Exception(); |
5260 Handle<String> name = Handle<String>::cast(converted); | 5264 Handle<String> name = Handle<String>::cast(converted); |
5261 | 5265 |
5262 if (name->AsArrayIndex(&index)) { | 5266 if (name->AsArrayIndex(&index)) { |
5263 return js_object->SetElement( | 5267 return js_object->SetElement( |
5264 index, *value, attr, kNonStrictMode, false, DEFINE_PROPERTY); | 5268 index, *value, attr, kNonStrictMode, false, DEFINE_PROPERTY); |
5265 } else { | 5269 } else { |
5266 return js_object->SetLocalPropertyIgnoreAttributes(*name, *value, attr); | 5270 return js_object->SetLocalPropertyIgnoreAttributes(*name, *value, attr); |
5267 } | 5271 } |
5268 } | 5272 } |
(...skipping 22 matching lines...) Expand all Loading... |
5291 RETURN_IF_EMPTY_HANDLE(isolate, result); | 5295 RETURN_IF_EMPTY_HANDLE(isolate, result); |
5292 return *result; | 5296 return *result; |
5293 } | 5297 } |
5294 | 5298 |
5295 Handle<Name> name; | 5299 Handle<Name> name; |
5296 if (key->IsName()) { | 5300 if (key->IsName()) { |
5297 name = Handle<Name>::cast(key); | 5301 name = Handle<Name>::cast(key); |
5298 } else { | 5302 } else { |
5299 // Call-back into JavaScript to convert the key to a string. | 5303 // Call-back into JavaScript to convert the key to a string. |
5300 bool has_pending_exception = false; | 5304 bool has_pending_exception = false; |
5301 Handle<Object> converted = Execution::ToString(key, &has_pending_exception); | 5305 Handle<Object> converted = Execution::ToString( |
| 5306 isolate, key, &has_pending_exception); |
5302 if (has_pending_exception) return Failure::Exception(); | 5307 if (has_pending_exception) return Failure::Exception(); |
5303 name = Handle<String>::cast(converted); | 5308 name = Handle<String>::cast(converted); |
5304 } | 5309 } |
5305 | 5310 |
5306 if (name->IsString()) Handle<String>::cast(name)->TryFlatten(); | 5311 if (name->IsString()) Handle<String>::cast(name)->TryFlatten(); |
5307 Handle<Object> result = JSReceiver::DeleteProperty(receiver, name, mode); | 5312 Handle<Object> result = JSReceiver::DeleteProperty(receiver, name, mode); |
5308 RETURN_IF_EMPTY_HANDLE(isolate, result); | 5313 RETURN_IF_EMPTY_HANDLE(isolate, result); |
5309 return *result; | 5314 return *result; |
5310 } | 5315 } |
5311 | 5316 |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5883 if (args[0]->IsSymbol()) { | 5888 if (args[0]->IsSymbol()) { |
5884 // Lookup in the initial Object.prototype object. | 5889 // Lookup in the initial Object.prototype object. |
5885 return isolate->initial_object_prototype()->GetProperty( | 5890 return isolate->initial_object_prototype()->GetProperty( |
5886 Symbol::cast(args[0])); | 5891 Symbol::cast(args[0])); |
5887 } | 5892 } |
5888 | 5893 |
5889 // Convert the key to a string. | 5894 // Convert the key to a string. |
5890 HandleScope scope(isolate); | 5895 HandleScope scope(isolate); |
5891 bool exception = false; | 5896 bool exception = false; |
5892 Handle<Object> converted = | 5897 Handle<Object> converted = |
5893 Execution::ToString(args.at<Object>(0), &exception); | 5898 Execution::ToString(isolate, args.at<Object>(0), &exception); |
5894 if (exception) return Failure::Exception(); | 5899 if (exception) return Failure::Exception(); |
5895 Handle<String> key = Handle<String>::cast(converted); | 5900 Handle<String> key = Handle<String>::cast(converted); |
5896 | 5901 |
5897 // Try to convert the string key into an array index. | 5902 // Try to convert the string key into an array index. |
5898 if (key->AsArrayIndex(&index)) { | 5903 if (key->AsArrayIndex(&index)) { |
5899 if (index < n) { | 5904 if (index < n) { |
5900 return frame->GetParameter(index); | 5905 return frame->GetParameter(index); |
5901 } else { | 5906 } else { |
5902 return isolate->initial_object_prototype()->GetElement(index); | 5907 return isolate->initial_object_prototype()->GetElement(index); |
5903 } | 5908 } |
(...skipping 2240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8144 int total_argc = 0; | 8149 int total_argc = 0; |
8145 SmartArrayPointer<Handle<Object> > param_data = | 8150 SmartArrayPointer<Handle<Object> > param_data = |
8146 GetCallerArguments(isolate, bound_argc, &total_argc); | 8151 GetCallerArguments(isolate, bound_argc, &total_argc); |
8147 for (int i = 0; i < bound_argc; i++) { | 8152 for (int i = 0; i < bound_argc; i++) { |
8148 param_data[i] = Handle<Object>(bound_args->get( | 8153 param_data[i] = Handle<Object>(bound_args->get( |
8149 JSFunction::kBoundArgumentsStartIndex + i), isolate); | 8154 JSFunction::kBoundArgumentsStartIndex + i), isolate); |
8150 } | 8155 } |
8151 | 8156 |
8152 if (!bound_function->IsJSFunction()) { | 8157 if (!bound_function->IsJSFunction()) { |
8153 bool exception_thrown; | 8158 bool exception_thrown; |
8154 bound_function = Execution::TryGetConstructorDelegate(bound_function, | 8159 bound_function = Execution::TryGetConstructorDelegate(isolate, |
| 8160 bound_function, |
8155 &exception_thrown); | 8161 &exception_thrown); |
8156 if (exception_thrown) return Failure::Exception(); | 8162 if (exception_thrown) return Failure::Exception(); |
8157 } | 8163 } |
8158 ASSERT(bound_function->IsJSFunction()); | 8164 ASSERT(bound_function->IsJSFunction()); |
8159 | 8165 |
8160 bool exception = false; | 8166 bool exception = false; |
8161 Handle<Object> result = | 8167 Handle<Object> result = |
8162 Execution::New(Handle<JSFunction>::cast(bound_function), | 8168 Execution::New(Handle<JSFunction>::cast(bound_function), |
8163 total_argc, *param_data, &exception); | 8169 total_argc, *param_data, &exception); |
8164 if (exception) { | 8170 if (exception) { |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8774 | 8780 |
8775 if (threw) return Failure::Exception(); | 8781 if (threw) return Failure::Exception(); |
8776 return *result; | 8782 return *result; |
8777 } | 8783 } |
8778 | 8784 |
8779 | 8785 |
8780 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFunctionDelegate) { | 8786 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFunctionDelegate) { |
8781 HandleScope scope(isolate); | 8787 HandleScope scope(isolate); |
8782 ASSERT(args.length() == 1); | 8788 ASSERT(args.length() == 1); |
8783 RUNTIME_ASSERT(!args[0]->IsJSFunction()); | 8789 RUNTIME_ASSERT(!args[0]->IsJSFunction()); |
8784 return *Execution::GetFunctionDelegate(args.at<Object>(0)); | 8790 return *Execution::GetFunctionDelegate(isolate, args.at<Object>(0)); |
8785 } | 8791 } |
8786 | 8792 |
8787 | 8793 |
8788 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetConstructorDelegate) { | 8794 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetConstructorDelegate) { |
8789 HandleScope scope(isolate); | 8795 HandleScope scope(isolate); |
8790 ASSERT(args.length() == 1); | 8796 ASSERT(args.length() == 1); |
8791 RUNTIME_ASSERT(!args[0]->IsJSFunction()); | 8797 RUNTIME_ASSERT(!args[0]->IsJSFunction()); |
8792 return *Execution::GetConstructorDelegate(args.at<Object>(0)); | 8798 return *Execution::GetConstructorDelegate(isolate, args.at<Object>(0)); |
8793 } | 8799 } |
8794 | 8800 |
8795 | 8801 |
8796 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewGlobalContext) { | 8802 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewGlobalContext) { |
8797 SealHandleScope shs(isolate); | 8803 SealHandleScope shs(isolate); |
8798 ASSERT(args.length() == 2); | 8804 ASSERT(args.length() == 2); |
8799 | 8805 |
8800 CONVERT_ARG_CHECKED(JSFunction, function, 0); | 8806 CONVERT_ARG_CHECKED(JSFunction, function, 0); |
8801 CONVERT_ARG_CHECKED(ScopeInfo, scope_info, 1); | 8807 CONVERT_ARG_CHECKED(ScopeInfo, scope_info, 1); |
8802 Context* result; | 8808 Context* result; |
(...skipping 1766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10569 AccessorComponent component = flag == 0 ? ACCESSOR_GETTER : ACCESSOR_SETTER; | 10575 AccessorComponent component = flag == 0 ? ACCESSOR_GETTER : ACCESSOR_SETTER; |
10570 if (!receiver->IsJSObject()) return isolate->heap()->undefined_value(); | 10576 if (!receiver->IsJSObject()) return isolate->heap()->undefined_value(); |
10571 return JSObject::cast(receiver)->LookupAccessor(name, component); | 10577 return JSObject::cast(receiver)->LookupAccessor(name, component); |
10572 } | 10578 } |
10573 | 10579 |
10574 | 10580 |
10575 #ifdef ENABLE_DEBUGGER_SUPPORT | 10581 #ifdef ENABLE_DEBUGGER_SUPPORT |
10576 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugBreak) { | 10582 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugBreak) { |
10577 SealHandleScope shs(isolate); | 10583 SealHandleScope shs(isolate); |
10578 ASSERT(args.length() == 0); | 10584 ASSERT(args.length() == 0); |
10579 return Execution::DebugBreakHelper(); | 10585 return Execution::DebugBreakHelper(isolate); |
10580 } | 10586 } |
10581 | 10587 |
10582 | 10588 |
10583 // Helper functions for wrapping and unwrapping stack frame ids. | 10589 // Helper functions for wrapping and unwrapping stack frame ids. |
10584 static Smi* WrapFrameId(StackFrame::Id id) { | 10590 static Smi* WrapFrameId(StackFrame::Id id) { |
10585 ASSERT(IsAligned(OffsetFrom(id), static_cast<intptr_t>(4))); | 10591 ASSERT(IsAligned(OffsetFrom(id), static_cast<intptr_t>(4))); |
10586 return Smi::FromInt(id >> 2); | 10592 return Smi::FromInt(id >> 2); |
10587 } | 10593 } |
10588 | 10594 |
10589 | 10595 |
(...skipping 2071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12661 RUNTIME_ARGUMENTS(isolate, args)); | 12667 RUNTIME_ARGUMENTS(isolate, args)); |
12662 if (!maybe_result->ToObject(&check_result)) return maybe_result; | 12668 if (!maybe_result->ToObject(&check_result)) return maybe_result; |
12663 } | 12669 } |
12664 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); | 12670 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); |
12665 CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]); | 12671 CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]); |
12666 CONVERT_ARG_HANDLE_CHECKED(String, source, 3); | 12672 CONVERT_ARG_HANDLE_CHECKED(String, source, 3); |
12667 CONVERT_BOOLEAN_ARG_CHECKED(disable_break, 4); | 12673 CONVERT_BOOLEAN_ARG_CHECKED(disable_break, 4); |
12668 Handle<Object> context_extension(args[5], isolate); | 12674 Handle<Object> context_extension(args[5], isolate); |
12669 | 12675 |
12670 // Handle the processing of break. | 12676 // Handle the processing of break. |
12671 DisableBreak disable_break_save(disable_break); | 12677 DisableBreak disable_break_save(isolate, disable_break); |
12672 | 12678 |
12673 // Get the frame where the debugging is performed. | 12679 // Get the frame where the debugging is performed. |
12674 StackFrame::Id id = UnwrapFrameId(wrapped_id); | 12680 StackFrame::Id id = UnwrapFrameId(wrapped_id); |
12675 JavaScriptFrameIterator it(isolate, id); | 12681 JavaScriptFrameIterator it(isolate, id); |
12676 JavaScriptFrame* frame = it.frame(); | 12682 JavaScriptFrame* frame = it.frame(); |
12677 FrameInspector frame_inspector(frame, inlined_jsframe_index, isolate); | 12683 FrameInspector frame_inspector(frame, inlined_jsframe_index, isolate); |
12678 Handle<JSFunction> function(JSFunction::cast(frame_inspector.GetFunction())); | 12684 Handle<JSFunction> function(JSFunction::cast(frame_inspector.GetFunction())); |
12679 | 12685 |
12680 // Traverse the saved contexts chain to find the active context for the | 12686 // Traverse the saved contexts chain to find the active context for the |
12681 // selected frame. | 12687 // selected frame. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12728 Object* check_result; | 12734 Object* check_result; |
12729 { MaybeObject* maybe_result = Runtime_CheckExecutionState( | 12735 { MaybeObject* maybe_result = Runtime_CheckExecutionState( |
12730 RUNTIME_ARGUMENTS(isolate, args)); | 12736 RUNTIME_ARGUMENTS(isolate, args)); |
12731 if (!maybe_result->ToObject(&check_result)) return maybe_result; | 12737 if (!maybe_result->ToObject(&check_result)) return maybe_result; |
12732 } | 12738 } |
12733 CONVERT_ARG_HANDLE_CHECKED(String, source, 1); | 12739 CONVERT_ARG_HANDLE_CHECKED(String, source, 1); |
12734 CONVERT_BOOLEAN_ARG_CHECKED(disable_break, 2); | 12740 CONVERT_BOOLEAN_ARG_CHECKED(disable_break, 2); |
12735 Handle<Object> context_extension(args[3], isolate); | 12741 Handle<Object> context_extension(args[3], isolate); |
12736 | 12742 |
12737 // Handle the processing of break. | 12743 // Handle the processing of break. |
12738 DisableBreak disable_break_save(disable_break); | 12744 DisableBreak disable_break_save(isolate, disable_break); |
12739 | 12745 |
12740 // Enter the top context from before the debugger was invoked. | 12746 // Enter the top context from before the debugger was invoked. |
12741 SaveContext save(isolate); | 12747 SaveContext save(isolate); |
12742 SaveContext* top = &save; | 12748 SaveContext* top = &save; |
12743 while (top != NULL && *top->context() == *isolate->debug()->debug_context()) { | 12749 while (top != NULL && *top->context() == *isolate->debug()->debug_context()) { |
12744 top = top->prev(); | 12750 top = top->prev(); |
12745 } | 12751 } |
12746 if (top != NULL) { | 12752 if (top != NULL) { |
12747 isolate->set_context(*top->context()); | 12753 isolate->set_context(*top->context()); |
12748 } | 12754 } |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13396 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 13402 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
13397 CONVERT_BOOLEAN_ARG_CHECKED(without_debugger, 1); | 13403 CONVERT_BOOLEAN_ARG_CHECKED(without_debugger, 1); |
13398 | 13404 |
13399 Handle<Object> result; | 13405 Handle<Object> result; |
13400 bool pending_exception; | 13406 bool pending_exception; |
13401 { | 13407 { |
13402 if (without_debugger) { | 13408 if (without_debugger) { |
13403 result = Execution::Call(function, isolate->global_object(), 0, NULL, | 13409 result = Execution::Call(function, isolate->global_object(), 0, NULL, |
13404 &pending_exception); | 13410 &pending_exception); |
13405 } else { | 13411 } else { |
13406 EnterDebugger enter_debugger; | 13412 EnterDebugger enter_debugger(isolate); |
13407 result = Execution::Call(function, isolate->global_object(), 0, NULL, | 13413 result = Execution::Call(function, isolate->global_object(), 0, NULL, |
13408 &pending_exception); | 13414 &pending_exception); |
13409 } | 13415 } |
13410 } | 13416 } |
13411 if (!pending_exception) { | 13417 if (!pending_exception) { |
13412 return *result; | 13418 return *result; |
13413 } else { | 13419 } else { |
13414 return Failure::Exception(); | 13420 return Failure::Exception(); |
13415 } | 13421 } |
13416 } | 13422 } |
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14695 // Handle last resort GC and make sure to allow future allocations | 14701 // Handle last resort GC and make sure to allow future allocations |
14696 // to grow the heap without causing GCs (if possible). | 14702 // to grow the heap without causing GCs (if possible). |
14697 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14703 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14698 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14704 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14699 "Runtime::PerformGC"); | 14705 "Runtime::PerformGC"); |
14700 } | 14706 } |
14701 } | 14707 } |
14702 | 14708 |
14703 | 14709 |
14704 } } // namespace v8::internal | 14710 } } // namespace v8::internal |
OLD | NEW |