| OLD | NEW |
| 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 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 } | 869 } |
| 870 | 870 |
| 871 case JSObject::DICTIONARY_ELEMENT: { | 871 case JSObject::DICTIONARY_ELEMENT: { |
| 872 Handle<JSObject> holder = obj; | 872 Handle<JSObject> holder = obj; |
| 873 if (obj->IsJSGlobalProxy()) { | 873 if (obj->IsJSGlobalProxy()) { |
| 874 Object* proto = obj->GetPrototype(); | 874 Object* proto = obj->GetPrototype(); |
| 875 if (proto->IsNull()) return heap->undefined_value(); | 875 if (proto->IsNull()) return heap->undefined_value(); |
| 876 ASSERT(proto->IsJSGlobalObject()); | 876 ASSERT(proto->IsJSGlobalObject()); |
| 877 holder = Handle<JSObject>(JSObject::cast(proto)); | 877 holder = Handle<JSObject>(JSObject::cast(proto)); |
| 878 } | 878 } |
| 879 NumberDictionary* dictionary = holder->element_dictionary(); | 879 FixedArray* elements = FixedArray::cast(holder->elements()); |
| 880 NumberDictionary* dictionary = NULL; |
| 881 if (elements->map() == heap->non_strict_arguments_elements_map()) { |
| 882 dictionary = NumberDictionary::cast(elements->get(1)); |
| 883 } else { |
| 884 dictionary = NumberDictionary::cast(elements); |
| 885 } |
| 880 int entry = dictionary->FindEntry(index); | 886 int entry = dictionary->FindEntry(index); |
| 881 ASSERT(entry != NumberDictionary::kNotFound); | 887 ASSERT(entry != NumberDictionary::kNotFound); |
| 882 PropertyDetails details = dictionary->DetailsAt(entry); | 888 PropertyDetails details = dictionary->DetailsAt(entry); |
| 883 switch (details.type()) { | 889 switch (details.type()) { |
| 884 case CALLBACKS: { | 890 case CALLBACKS: { |
| 885 // This is an accessor property with getter and/or setter. | 891 // This is an accessor property with getter and/or setter. |
| 886 FixedArray* callbacks = | 892 FixedArray* callbacks = |
| 887 FixedArray::cast(dictionary->ValueAt(entry)); | 893 FixedArray::cast(dictionary->ValueAt(entry)); |
| 888 elms->set(IS_ACCESSOR_INDEX, heap->true_value()); | 894 elms->set(IS_ACCESSOR_INDEX, heap->true_value()); |
| 889 if (CheckElementAccess(*obj, index, v8::ACCESS_GET)) { | 895 if (CheckElementAccess(*obj, index, v8::ACCESS_GET)) { |
| (...skipping 3142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4032 return *value; | 4038 return *value; |
| 4033 } | 4039 } |
| 4034 | 4040 |
| 4035 // Call-back into JavaScript to convert the key to a string. | 4041 // Call-back into JavaScript to convert the key to a string. |
| 4036 bool has_pending_exception = false; | 4042 bool has_pending_exception = false; |
| 4037 Handle<Object> converted = Execution::ToString(key, &has_pending_exception); | 4043 Handle<Object> converted = Execution::ToString(key, &has_pending_exception); |
| 4038 if (has_pending_exception) return Failure::Exception(); | 4044 if (has_pending_exception) return Failure::Exception(); |
| 4039 Handle<String> name = Handle<String>::cast(converted); | 4045 Handle<String> name = Handle<String>::cast(converted); |
| 4040 | 4046 |
| 4041 if (name->AsArrayIndex(&index)) { | 4047 if (name->AsArrayIndex(&index)) { |
| 4042 return js_object->SetElement(index, *value, strict_mode); | 4048 return js_object->SetElement(index, *value, strict_mode, true); |
| 4043 } else { | 4049 } else { |
| 4044 return js_object->SetProperty(*name, *value, attr, strict_mode); | 4050 return js_object->SetProperty(*name, *value, attr, strict_mode); |
| 4045 } | 4051 } |
| 4046 } | 4052 } |
| 4047 | 4053 |
| 4048 | 4054 |
| 4049 MaybeObject* Runtime::ForceSetObjectProperty(Isolate* isolate, | 4055 MaybeObject* Runtime::ForceSetObjectProperty(Isolate* isolate, |
| 4050 Handle<JSObject> js_object, | 4056 Handle<JSObject> js_object, |
| 4051 Handle<Object> key, | 4057 Handle<Object> key, |
| 4052 Handle<Object> value, | 4058 Handle<Object> value, |
| 4053 PropertyAttributes attr) { | 4059 PropertyAttributes attr) { |
| 4054 HandleScope scope(isolate); | 4060 HandleScope scope(isolate); |
| 4055 | 4061 |
| 4056 // Check if the given key is an array index. | 4062 // Check if the given key is an array index. |
| 4057 uint32_t index; | 4063 uint32_t index; |
| 4058 if (key->ToArrayIndex(&index)) { | 4064 if (key->ToArrayIndex(&index)) { |
| 4059 // In Firefox/SpiderMonkey, Safari and Opera you can access the characters | 4065 // In Firefox/SpiderMonkey, Safari and Opera you can access the characters |
| 4060 // of a string using [] notation. We need to support this too in | 4066 // of a string using [] notation. We need to support this too in |
| 4061 // JavaScript. | 4067 // JavaScript. |
| 4062 // In the case of a String object we just need to redirect the assignment to | 4068 // In the case of a String object we just need to redirect the assignment to |
| 4063 // the underlying string if the index is in range. Since the underlying | 4069 // the underlying string if the index is in range. Since the underlying |
| 4064 // string does nothing with the assignment then we can ignore such | 4070 // string does nothing with the assignment then we can ignore such |
| 4065 // assignments. | 4071 // assignments. |
| 4066 if (js_object->IsStringObjectWithCharacterAt(index)) { | 4072 if (js_object->IsStringObjectWithCharacterAt(index)) { |
| 4067 return *value; | 4073 return *value; |
| 4068 } | 4074 } |
| 4069 | 4075 |
| 4070 return js_object->SetElement(index, *value, kNonStrictMode); | 4076 return js_object->SetElement(index, *value, kNonStrictMode, true); |
| 4071 } | 4077 } |
| 4072 | 4078 |
| 4073 if (key->IsString()) { | 4079 if (key->IsString()) { |
| 4074 if (Handle<String>::cast(key)->AsArrayIndex(&index)) { | 4080 if (Handle<String>::cast(key)->AsArrayIndex(&index)) { |
| 4075 return js_object->SetElement(index, *value, kNonStrictMode); | 4081 return js_object->SetElement(index, *value, kNonStrictMode, true); |
| 4076 } else { | 4082 } else { |
| 4077 Handle<String> key_string = Handle<String>::cast(key); | 4083 Handle<String> key_string = Handle<String>::cast(key); |
| 4078 key_string->TryFlatten(); | 4084 key_string->TryFlatten(); |
| 4079 return js_object->SetLocalPropertyIgnoreAttributes(*key_string, | 4085 return js_object->SetLocalPropertyIgnoreAttributes(*key_string, |
| 4080 *value, | 4086 *value, |
| 4081 attr); | 4087 attr); |
| 4082 } | 4088 } |
| 4083 } | 4089 } |
| 4084 | 4090 |
| 4085 // Call-back into JavaScript to convert the key to a string. | 4091 // Call-back into JavaScript to convert the key to a string. |
| 4086 bool has_pending_exception = false; | 4092 bool has_pending_exception = false; |
| 4087 Handle<Object> converted = Execution::ToString(key, &has_pending_exception); | 4093 Handle<Object> converted = Execution::ToString(key, &has_pending_exception); |
| 4088 if (has_pending_exception) return Failure::Exception(); | 4094 if (has_pending_exception) return Failure::Exception(); |
| 4089 Handle<String> name = Handle<String>::cast(converted); | 4095 Handle<String> name = Handle<String>::cast(converted); |
| 4090 | 4096 |
| 4091 if (name->AsArrayIndex(&index)) { | 4097 if (name->AsArrayIndex(&index)) { |
| 4092 return js_object->SetElement(index, *value, kNonStrictMode); | 4098 return js_object->SetElement(index, *value, kNonStrictMode, true); |
| 4093 } else { | 4099 } else { |
| 4094 return js_object->SetLocalPropertyIgnoreAttributes(*name, *value, attr); | 4100 return js_object->SetLocalPropertyIgnoreAttributes(*name, *value, attr); |
| 4095 } | 4101 } |
| 4096 } | 4102 } |
| 4097 | 4103 |
| 4098 | 4104 |
| 4099 MaybeObject* Runtime::ForceDeleteObjectProperty(Isolate* isolate, | 4105 MaybeObject* Runtime::ForceDeleteObjectProperty(Isolate* isolate, |
| 4100 Handle<JSObject> js_object, | 4106 Handle<JSObject> js_object, |
| 4101 Handle<Object> key) { | 4107 Handle<Object> key) { |
| 4102 HandleScope scope(isolate); | 4108 HandleScope scope(isolate); |
| (...skipping 3233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7336 | 7342 |
| 7337 elms->set(0, Smi::FromInt(year)); | 7343 elms->set(0, Smi::FromInt(year)); |
| 7338 elms->set(1, Smi::FromInt(month)); | 7344 elms->set(1, Smi::FromInt(month)); |
| 7339 elms->set(2, Smi::FromInt(day)); | 7345 elms->set(2, Smi::FromInt(day)); |
| 7340 | 7346 |
| 7341 return isolate->heap()->undefined_value(); | 7347 return isolate->heap()->undefined_value(); |
| 7342 } | 7348 } |
| 7343 | 7349 |
| 7344 | 7350 |
| 7345 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewArgumentsFast) { | 7351 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewArgumentsFast) { |
| 7352 HandleScope scope(isolate); |
| 7353 ASSERT(args.length() == 3); |
| 7354 |
| 7355 Handle<JSFunction> callee = args.at<JSFunction>(0); |
| 7356 Object** parameters = reinterpret_cast<Object**>(args[1]); |
| 7357 const int argument_count = Smi::cast(args[2])->value(); |
| 7358 |
| 7359 Handle<JSObject> result = |
| 7360 isolate->factory()->NewArgumentsObject(callee, argument_count); |
| 7361 // Allocate the elements if needed. |
| 7362 int parameter_count = callee->shared()->formal_parameter_count(); |
| 7363 if (argument_count > 0) { |
| 7364 if (parameter_count > 0) { |
| 7365 int mapped_count = Min(argument_count, parameter_count); |
| 7366 Handle<FixedArray> parameter_map = |
| 7367 isolate->factory()->NewFixedArray(mapped_count + 2, NOT_TENURED); |
| 7368 parameter_map->set_map( |
| 7369 isolate->heap()->non_strict_arguments_elements_map()); |
| 7370 |
| 7371 Handle<Map> old_map(result->map()); |
| 7372 Handle<Map> new_map = |
| 7373 isolate->factory()->CopyMapDropTransitions(old_map); |
| 7374 new_map->set_elements_kind(JSObject::NON_STRICT_ARGUMENTS_ELEMENTS); |
| 7375 |
| 7376 result->set_map(*new_map); |
| 7377 result->set_elements(*parameter_map); |
| 7378 |
| 7379 // Store the context and the arguments array at the beginning of the |
| 7380 // parameter map. |
| 7381 Handle<Context> context(isolate->context()); |
| 7382 Handle<FixedArray> arguments = |
| 7383 isolate->factory()->NewFixedArray(argument_count, NOT_TENURED); |
| 7384 parameter_map->set(0, *context); |
| 7385 parameter_map->set(1, *arguments); |
| 7386 |
| 7387 // Loop over the actual parameters backwards. |
| 7388 int index = argument_count - 1; |
| 7389 while (index >= mapped_count) { |
| 7390 // These go directly in the arguments array and have no |
| 7391 // corresponding slot in the parameter map. |
| 7392 arguments->set(index, *(parameters - index - 1)); |
| 7393 --index; |
| 7394 } |
| 7395 |
| 7396 ScopeInfo<> scope_info(callee->shared()->scope_info()); |
| 7397 while (index >= 0) { |
| 7398 // Detect duplicate names to the right in the parameter list. |
| 7399 Handle<String> name = scope_info.parameter_name(index); |
| 7400 int context_slot_count = scope_info.number_of_context_slots(); |
| 7401 bool duplicate = false; |
| 7402 for (int j = index + 1; j < parameter_count; ++j) { |
| 7403 if (scope_info.parameter_name(j).is_identical_to(name)) { |
| 7404 duplicate = true; |
| 7405 break; |
| 7406 } |
| 7407 } |
| 7408 |
| 7409 if (duplicate) { |
| 7410 // This goes directly in the arguments array with a hole in the |
| 7411 // parameter map. |
| 7412 arguments->set(index, *(parameters - index - 1)); |
| 7413 parameter_map->set_the_hole(index + 2); |
| 7414 } else { |
| 7415 // The context index goes in the parameter map with a hole in the |
| 7416 // arguments array. |
| 7417 int context_index = -1; |
| 7418 for (int j = Context::MIN_CONTEXT_SLOTS; |
| 7419 j < context_slot_count; |
| 7420 ++j) { |
| 7421 if (scope_info.context_slot_name(j).is_identical_to(name)) { |
| 7422 context_index = j; |
| 7423 break; |
| 7424 } |
| 7425 } |
| 7426 ASSERT(context_index >= 0); |
| 7427 arguments->set_the_hole(index); |
| 7428 parameter_map->set(index + 2, Smi::FromInt(context_index)); |
| 7429 } |
| 7430 |
| 7431 --index; |
| 7432 } |
| 7433 } else { |
| 7434 // If there is no aliasing, the arguments object elements are not |
| 7435 // special in any way. |
| 7436 Handle<FixedArray> elements = |
| 7437 isolate->factory()->NewFixedArray(argument_count, NOT_TENURED); |
| 7438 result->set_elements(*elements); |
| 7439 for (int i = 0; i < argument_count; ++i) { |
| 7440 elements->set(i, *(parameters - i - 1)); |
| 7441 } |
| 7442 } |
| 7443 } |
| 7444 return *result; |
| 7445 } |
| 7446 |
| 7447 |
| 7448 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewStrictArgumentsFast) { |
| 7346 NoHandleAllocation ha; | 7449 NoHandleAllocation ha; |
| 7347 ASSERT(args.length() == 3); | 7450 ASSERT(args.length() == 3); |
| 7348 | 7451 |
| 7349 JSFunction* callee = JSFunction::cast(args[0]); | 7452 JSFunction* callee = JSFunction::cast(args[0]); |
| 7350 Object** parameters = reinterpret_cast<Object**>(args[1]); | 7453 Object** parameters = reinterpret_cast<Object**>(args[1]); |
| 7351 const int length = args.smi_at(2); | 7454 const int length = args.smi_at(2); |
| 7352 | 7455 |
| 7353 Object* result; | 7456 Object* result; |
| 7354 { MaybeObject* maybe_result = | 7457 { MaybeObject* maybe_result = |
| 7355 isolate->heap()->AllocateArgumentsObject(callee, length); | 7458 isolate->heap()->AllocateArgumentsObject(callee, length); |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7777 return Smi::FromInt(function->shared()->opt_count()); | 7880 return Smi::FromInt(function->shared()->opt_count()); |
| 7778 } | 7881 } |
| 7779 | 7882 |
| 7780 | 7883 |
| 7781 RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileForOnStackReplacement) { | 7884 RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileForOnStackReplacement) { |
| 7782 HandleScope scope(isolate); | 7885 HandleScope scope(isolate); |
| 7783 ASSERT(args.length() == 1); | 7886 ASSERT(args.length() == 1); |
| 7784 CONVERT_ARG_CHECKED(JSFunction, function, 0); | 7887 CONVERT_ARG_CHECKED(JSFunction, function, 0); |
| 7785 | 7888 |
| 7786 // We're not prepared to handle a function with arguments object. | 7889 // We're not prepared to handle a function with arguments object. |
| 7787 ASSERT(!function->shared()->scope_info()->HasArgumentsShadow()); | 7890 ASSERT(!function->shared()->uses_arguments()); |
| 7788 | 7891 |
| 7789 // We have hit a back edge in an unoptimized frame for a function that was | 7892 // We have hit a back edge in an unoptimized frame for a function that was |
| 7790 // selected for on-stack replacement. Find the unoptimized code object. | 7893 // selected for on-stack replacement. Find the unoptimized code object. |
| 7791 Handle<Code> unoptimized(function->shared()->code(), isolate); | 7894 Handle<Code> unoptimized(function->shared()->code(), isolate); |
| 7792 // Keep track of whether we've succeeded in optimizing. | 7895 // Keep track of whether we've succeeded in optimizing. |
| 7793 bool succeeded = unoptimized->optimizable(); | 7896 bool succeeded = unoptimized->optimizable(); |
| 7794 if (succeeded) { | 7897 if (succeeded) { |
| 7795 // If we are trying to do OSR when there are already optimized | 7898 // If we are trying to do OSR when there are already optimized |
| 7796 // activations of the function, it means (a) the function is directly or | 7899 // activations of the function, it means (a) the function is directly or |
| 7797 // indirectly recursive and (b) an optimized invocation has been | 7900 // indirectly recursive and (b) an optimized invocation has been |
| (...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8742 CONVERT_CHECKED(JSArray, array, args[0]); | 8845 CONVERT_CHECKED(JSArray, array, args[0]); |
| 8743 CONVERT_CHECKED(JSObject, element, args[1]); | 8846 CONVERT_CHECKED(JSObject, element, args[1]); |
| 8744 RUNTIME_ASSERT(array->HasFastElements()); | 8847 RUNTIME_ASSERT(array->HasFastElements()); |
| 8745 int length = Smi::cast(array->length())->value(); | 8848 int length = Smi::cast(array->length())->value(); |
| 8746 FixedArray* elements = FixedArray::cast(array->elements()); | 8849 FixedArray* elements = FixedArray::cast(array->elements()); |
| 8747 for (int i = 0; i < length; i++) { | 8850 for (int i = 0; i < length; i++) { |
| 8748 if (elements->get(i) == element) return isolate->heap()->false_value(); | 8851 if (elements->get(i) == element) return isolate->heap()->false_value(); |
| 8749 } | 8852 } |
| 8750 Object* obj; | 8853 Object* obj; |
| 8751 // Strict not needed. Used for cycle detection in Array join implementation. | 8854 // Strict not needed. Used for cycle detection in Array join implementation. |
| 8752 { MaybeObject* maybe_obj = array->SetFastElement(length, element, | 8855 { MaybeObject* maybe_obj = |
| 8753 kNonStrictMode); | 8856 array->SetFastElement(length, element, kNonStrictMode, true); |
| 8754 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 8857 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 8755 } | 8858 } |
| 8756 return isolate->heap()->true_value(); | 8859 return isolate->heap()->true_value(); |
| 8757 } | 8860 } |
| 8758 | 8861 |
| 8759 | 8862 |
| 8760 /** | 8863 /** |
| 8761 * A simple visitor visits every element of Array's. | 8864 * A simple visitor visits every element of Array's. |
| 8762 * The backend storage can be a fixed array for fast elements case, | 8865 * The backend storage can be a fixed array for fast elements case, |
| 8763 * or a dictionary for sparse array. Since Dictionary is a subtype | 8866 * or a dictionary for sparse array. Since Dictionary is a subtype |
| (...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10054 ScopeInfo<>& scope_info, | 10157 ScopeInfo<>& scope_info, |
| 10055 Handle<Context> context, | 10158 Handle<Context> context, |
| 10056 Handle<JSObject> scope_object) { | 10159 Handle<JSObject> scope_object) { |
| 10057 // Fill all context locals to the context extension. | 10160 // Fill all context locals to the context extension. |
| 10058 for (int i = Context::MIN_CONTEXT_SLOTS; | 10161 for (int i = Context::MIN_CONTEXT_SLOTS; |
| 10059 i < scope_info.number_of_context_slots(); | 10162 i < scope_info.number_of_context_slots(); |
| 10060 i++) { | 10163 i++) { |
| 10061 int context_index = serialized_scope_info->ContextSlotIndex( | 10164 int context_index = serialized_scope_info->ContextSlotIndex( |
| 10062 *scope_info.context_slot_name(i), NULL); | 10165 *scope_info.context_slot_name(i), NULL); |
| 10063 | 10166 |
| 10064 // Don't include the arguments shadow (.arguments) context variable. | 10167 RETURN_IF_EMPTY_HANDLE_VALUE( |
| 10065 if (*scope_info.context_slot_name(i) != | 10168 isolate, |
| 10066 isolate->heap()->arguments_shadow_symbol()) { | 10169 SetProperty(scope_object, |
| 10067 RETURN_IF_EMPTY_HANDLE_VALUE( | 10170 scope_info.context_slot_name(i), |
| 10068 isolate, | 10171 Handle<Object>(context->get(context_index), isolate), |
| 10069 SetProperty(scope_object, | 10172 NONE, |
| 10070 scope_info.context_slot_name(i), | 10173 kNonStrictMode), |
| 10071 Handle<Object>(context->get(context_index), isolate), | 10174 false); |
| 10072 NONE, | |
| 10073 kNonStrictMode), | |
| 10074 false); | |
| 10075 } | |
| 10076 } | 10175 } |
| 10077 | 10176 |
| 10078 return true; | 10177 return true; |
| 10079 } | 10178 } |
| 10080 | 10179 |
| 10081 | 10180 |
| 10082 // Create a plain JSObject which materializes the local scope for the specified | 10181 // Create a plain JSObject which materializes the local scope for the specified |
| 10083 // frame. | 10182 // frame. |
| 10084 static Handle<JSObject> MaterializeLocalScope(Isolate* isolate, | 10183 static Handle<JSObject> MaterializeLocalScope(Isolate* isolate, |
| 10085 JavaScriptFrame* frame) { | 10184 JavaScriptFrame* frame) { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10160 | 10259 |
| 10161 Handle<SharedFunctionInfo> shared(context->closure()->shared()); | 10260 Handle<SharedFunctionInfo> shared(context->closure()->shared()); |
| 10162 Handle<SerializedScopeInfo> serialized_scope_info(shared->scope_info()); | 10261 Handle<SerializedScopeInfo> serialized_scope_info(shared->scope_info()); |
| 10163 ScopeInfo<> scope_info(*serialized_scope_info); | 10262 ScopeInfo<> scope_info(*serialized_scope_info); |
| 10164 | 10263 |
| 10165 // Allocate and initialize a JSObject with all the content of theis function | 10264 // Allocate and initialize a JSObject with all the content of theis function |
| 10166 // closure. | 10265 // closure. |
| 10167 Handle<JSObject> closure_scope = | 10266 Handle<JSObject> closure_scope = |
| 10168 isolate->factory()->NewJSObject(isolate->object_function()); | 10267 isolate->factory()->NewJSObject(isolate->object_function()); |
| 10169 | 10268 |
| 10170 // Check whether the arguments shadow object exists. | |
| 10171 int arguments_shadow_index = | |
| 10172 shared->scope_info()->ContextSlotIndex( | |
| 10173 isolate->heap()->arguments_shadow_symbol(), NULL); | |
| 10174 if (arguments_shadow_index >= 0) { | |
| 10175 // In this case all the arguments are available in the arguments shadow | |
| 10176 // object. | |
| 10177 Handle<JSObject> arguments_shadow( | |
| 10178 JSObject::cast(context->get(arguments_shadow_index))); | |
| 10179 for (int i = 0; i < scope_info.number_of_parameters(); ++i) { | |
| 10180 // We don't expect exception-throwing getters on the arguments shadow. | |
| 10181 Object* element = arguments_shadow->GetElement(i)->ToObjectUnchecked(); | |
| 10182 RETURN_IF_EMPTY_HANDLE_VALUE( | |
| 10183 isolate, | |
| 10184 SetProperty(closure_scope, | |
| 10185 scope_info.parameter_name(i), | |
| 10186 Handle<Object>(element, isolate), | |
| 10187 NONE, | |
| 10188 kNonStrictMode), | |
| 10189 Handle<JSObject>()); | |
| 10190 } | |
| 10191 } | |
| 10192 | |
| 10193 // Fill all context locals to the context extension. | 10269 // Fill all context locals to the context extension. |
| 10194 if (!CopyContextLocalsToScopeObject(isolate, | 10270 if (!CopyContextLocalsToScopeObject(isolate, |
| 10195 serialized_scope_info, scope_info, | 10271 serialized_scope_info, scope_info, |
| 10196 context, closure_scope)) { | 10272 context, closure_scope)) { |
| 10197 return Handle<JSObject>(); | 10273 return Handle<JSObject>(); |
| 10198 } | 10274 } |
| 10199 | 10275 |
| 10200 // Finally copy any properties from the function context extension. This will | 10276 // Finally copy any properties from the function context extension. This will |
| 10201 // be variables introduced by eval. | 10277 // be variables introduced by eval. |
| 10202 if (context->has_extension()) { | 10278 if (context->has_extension()) { |
| (...skipping 2181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12384 } else { | 12460 } else { |
| 12385 // Handle last resort GC and make sure to allow future allocations | 12461 // Handle last resort GC and make sure to allow future allocations |
| 12386 // to grow the heap without causing GCs (if possible). | 12462 // to grow the heap without causing GCs (if possible). |
| 12387 isolate->counters()->gc_last_resort_from_js()->Increment(); | 12463 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 12388 isolate->heap()->CollectAllGarbage(false); | 12464 isolate->heap()->CollectAllGarbage(false); |
| 12389 } | 12465 } |
| 12390 } | 12466 } |
| 12391 | 12467 |
| 12392 | 12468 |
| 12393 } } // namespace v8::internal | 12469 } } // namespace v8::internal |
| OLD | NEW |