| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/allocation-site-scopes.h" | 8 #include "src/allocation-site-scopes.h" |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
| (...skipping 10171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10182 instance_type = JS_OBJECT_TYPE; | 10182 instance_type = JS_OBJECT_TYPE; |
| 10183 instance_size = function->shared()->CalculateInstanceSize(); | 10183 instance_size = function->shared()->CalculateInstanceSize(); |
| 10184 in_object_properties = function->shared()->CalculateInObjectProperties(); | 10184 in_object_properties = function->shared()->CalculateInObjectProperties(); |
| 10185 } | 10185 } |
| 10186 Handle<Map> map = isolate->factory()->NewMap(instance_type, instance_size); | 10186 Handle<Map> map = isolate->factory()->NewMap(instance_type, instance_size); |
| 10187 | 10187 |
| 10188 // Fetch or allocate prototype. | 10188 // Fetch or allocate prototype. |
| 10189 Handle<Object> prototype; | 10189 Handle<Object> prototype; |
| 10190 if (function->has_instance_prototype()) { | 10190 if (function->has_instance_prototype()) { |
| 10191 prototype = handle(function->instance_prototype(), isolate); | 10191 prototype = handle(function->instance_prototype(), isolate); |
| 10192 for (Handle<Object> p = prototype; !p->IsNull() && !p->IsJSProxy(); |
| 10193 p = Object::GetPrototype(isolate, p)) { |
| 10194 JSObject::OptimizeAsPrototype(Handle<JSObject>::cast(p)); |
| 10195 } |
| 10192 } else { | 10196 } else { |
| 10193 prototype = isolate->factory()->NewFunctionPrototype(function); | 10197 prototype = isolate->factory()->NewFunctionPrototype(function); |
| 10194 } | 10198 } |
| 10195 map->set_inobject_properties(in_object_properties); | 10199 map->set_inobject_properties(in_object_properties); |
| 10196 map->set_unused_property_fields(in_object_properties); | 10200 map->set_unused_property_fields(in_object_properties); |
| 10197 map->set_prototype(*prototype); | 10201 map->set_prototype(*prototype); |
| 10198 ASSERT(map->has_fast_object_elements()); | 10202 ASSERT(map->has_fast_object_elements()); |
| 10199 | 10203 |
| 10200 // Finally link initial map and constructor function. | 10204 // Finally link initial map and constructor function. |
| 10201 function->set_initial_map(*map); | 10205 function->set_initial_map(*map); |
| (...skipping 6892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17094 #define ERROR_MESSAGES_TEXTS(C, T) T, | 17098 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 17095 static const char* error_messages_[] = { | 17099 static const char* error_messages_[] = { |
| 17096 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 17100 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 17097 }; | 17101 }; |
| 17098 #undef ERROR_MESSAGES_TEXTS | 17102 #undef ERROR_MESSAGES_TEXTS |
| 17099 return error_messages_[reason]; | 17103 return error_messages_[reason]; |
| 17100 } | 17104 } |
| 17101 | 17105 |
| 17102 | 17106 |
| 17103 } } // namespace v8::internal | 17107 } } // namespace v8::internal |
| OLD | NEW |