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 3069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3080 CONVERT_SMI_ARG_CHECKED(num, 1); | 3080 CONVERT_SMI_ARG_CHECKED(num, 1); |
3081 RUNTIME_ASSERT(num >= 0); | 3081 RUNTIME_ASSERT(num >= 0); |
3082 // If objects constructed from this function exist then changing | 3082 // If objects constructed from this function exist then changing |
3083 // 'estimated_nof_properties' is dangerous since the previous value might | 3083 // 'estimated_nof_properties' is dangerous since the previous value might |
3084 // have been compiled into the fast construct stub. Moreover, the inobject | 3084 // have been compiled into the fast construct stub. Moreover, the inobject |
3085 // slack tracking logic might have adjusted the previous value, so even | 3085 // slack tracking logic might have adjusted the previous value, so even |
3086 // passing the same value is risky. | 3086 // passing the same value is risky. |
3087 if (!func->shared()->live_objects_may_exist()) { | 3087 if (!func->shared()->live_objects_may_exist()) { |
3088 func->shared()->set_expected_nof_properties(num); | 3088 func->shared()->set_expected_nof_properties(num); |
3089 if (func->has_initial_map()) { | 3089 if (func->has_initial_map()) { |
3090 Handle<Map> new_initial_map = | 3090 Handle<Map> new_initial_map = Map::Copy(handle(func->initial_map())); |
3091 func->GetIsolate()->factory()->CopyMap( | |
3092 Handle<Map>(func->initial_map())); | |
3093 new_initial_map->set_unused_property_fields(num); | 3091 new_initial_map->set_unused_property_fields(num); |
3094 func->set_initial_map(*new_initial_map); | 3092 func->set_initial_map(*new_initial_map); |
3095 } | 3093 } |
3096 } | 3094 } |
3097 return isolate->heap()->undefined_value(); | 3095 return isolate->heap()->undefined_value(); |
3098 } | 3096 } |
3099 | 3097 |
3100 | 3098 |
3101 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_CreateJSGeneratorObject) { | 3099 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_CreateJSGeneratorObject) { |
3102 HandleScope scope(isolate); | 3100 HandleScope scope(isolate); |
(...skipping 4883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7986 // Allocate the elements if needed. | 7984 // Allocate the elements if needed. |
7987 int parameter_count = callee->shared()->formal_parameter_count(); | 7985 int parameter_count = callee->shared()->formal_parameter_count(); |
7988 if (argument_count > 0) { | 7986 if (argument_count > 0) { |
7989 if (parameter_count > 0) { | 7987 if (parameter_count > 0) { |
7990 int mapped_count = Min(argument_count, parameter_count); | 7988 int mapped_count = Min(argument_count, parameter_count); |
7991 Handle<FixedArray> parameter_map = | 7989 Handle<FixedArray> parameter_map = |
7992 isolate->factory()->NewFixedArray(mapped_count + 2, NOT_TENURED); | 7990 isolate->factory()->NewFixedArray(mapped_count + 2, NOT_TENURED); |
7993 parameter_map->set_map( | 7991 parameter_map->set_map( |
7994 isolate->heap()->sloppy_arguments_elements_map()); | 7992 isolate->heap()->sloppy_arguments_elements_map()); |
7995 | 7993 |
7996 Handle<Map> old_map(result->map()); | 7994 Handle<Map> map = Map::Copy(handle(result->map())); |
7997 Handle<Map> new_map = isolate->factory()->CopyMap(old_map); | 7995 map->set_elements_kind(SLOPPY_ARGUMENTS_ELEMENTS); |
7998 new_map->set_elements_kind(SLOPPY_ARGUMENTS_ELEMENTS); | |
7999 | 7996 |
8000 result->set_map(*new_map); | 7997 result->set_map(*map); |
8001 result->set_elements(*parameter_map); | 7998 result->set_elements(*parameter_map); |
8002 | 7999 |
8003 // Store the context and the arguments array at the beginning of the | 8000 // Store the context and the arguments array at the beginning of the |
8004 // parameter map. | 8001 // parameter map. |
8005 Handle<Context> context(isolate->context()); | 8002 Handle<Context> context(isolate->context()); |
8006 Handle<FixedArray> arguments = | 8003 Handle<FixedArray> arguments = |
8007 isolate->factory()->NewFixedArray(argument_count, NOT_TENURED); | 8004 isolate->factory()->NewFixedArray(argument_count, NOT_TENURED); |
8008 parameter_map->set(0, *context); | 8005 parameter_map->set(0, *context); |
8009 parameter_map->set(1, *arguments); | 8006 parameter_map->set(1, *arguments); |
8010 | 8007 |
(...skipping 7223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15234 } | 15231 } |
15235 } | 15232 } |
15236 | 15233 |
15237 | 15234 |
15238 void Runtime::OutOfMemory() { | 15235 void Runtime::OutOfMemory() { |
15239 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); | 15236 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); |
15240 UNREACHABLE(); | 15237 UNREACHABLE(); |
15241 } | 15238 } |
15242 | 15239 |
15243 } } // namespace v8::internal | 15240 } } // namespace v8::internal |
OLD | NEW |