OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 2069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2080 | 2080 |
2081 // Convert the parameters | 2081 // Convert the parameters |
2082 Handle<JSObject> object = args.at<JSObject>(0); | 2082 Handle<JSObject> object = args.at<JSObject>(0); |
2083 Handle<Map> transition = args.at<Map>(1); | 2083 Handle<Map> transition = args.at<Map>(1); |
2084 Handle<Object> value = args.at<Object>(2); | 2084 Handle<Object> value = args.at<Object>(2); |
2085 | 2085 |
2086 // Check the object has run out out property space. | 2086 // Check the object has run out out property space. |
2087 ASSERT(object->HasFastProperties()); | 2087 ASSERT(object->HasFastProperties()); |
2088 ASSERT(object->map()->unused_property_fields() == 0); | 2088 ASSERT(object->map()->unused_property_fields() == 0); |
2089 | 2089 |
2090 // Expand the properties array. | 2090 JSObject::MigrateToNewProperty(object, transition, value); |
2091 Handle<FixedArray> old_storage = handle(object->properties(), isolate); | |
2092 int new_unused = transition->unused_property_fields(); | |
2093 int new_size = old_storage->length() + new_unused + 1; | |
2094 | |
2095 Handle<FixedArray> new_storage = FixedArray::CopySize(old_storage, new_size); | |
2096 | |
2097 Handle<Object> to_store = value; | |
2098 | |
2099 PropertyDetails details = transition->instance_descriptors()->GetDetails( | |
2100 transition->LastAdded()); | |
2101 if (details.representation().IsDouble()) { | |
2102 to_store = isolate->factory()->NewHeapNumber(value->Number()); | |
2103 } | |
2104 | |
2105 new_storage->set(old_storage->length(), *to_store); | |
2106 | |
2107 // Set the new property value and do the map transition. | |
2108 object->set_properties(*new_storage); | |
2109 object->set_map(*transition); | |
2110 | 2091 |
2111 // Return the stored value. | 2092 // Return the stored value. |
2112 return *value; | 2093 return *value; |
2113 } | 2094 } |
2114 | 2095 |
2115 | 2096 |
2116 // Used from ic-<arch>.cc. | 2097 // Used from ic-<arch>.cc. |
2117 RUNTIME_FUNCTION(KeyedStoreIC_Miss) { | 2098 RUNTIME_FUNCTION(KeyedStoreIC_Miss) { |
2118 Logger::TimerEventScope timer( | 2099 Logger::TimerEventScope timer( |
2119 isolate, Logger::TimerEventScope::v8_ic_miss); | 2100 isolate, Logger::TimerEventScope::v8_ic_miss); |
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3098 #undef ADDR | 3079 #undef ADDR |
3099 }; | 3080 }; |
3100 | 3081 |
3101 | 3082 |
3102 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 3083 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
3103 return IC_utilities[id]; | 3084 return IC_utilities[id]; |
3104 } | 3085 } |
3105 | 3086 |
3106 | 3087 |
3107 } } // namespace v8::internal | 3088 } } // namespace v8::internal |
OLD | NEW |