OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 func->set_initial_map(*new_initial_map); | 79 func->set_initial_map(*new_initial_map); |
80 } | 80 } |
81 } | 81 } |
82 | 82 |
83 | 83 |
84 void SetPrototypeProperty(Handle<JSFunction> func, Handle<JSObject> value) { | 84 void SetPrototypeProperty(Handle<JSFunction> func, Handle<JSObject> value) { |
85 CALL_HEAP_FUNCTION_VOID(func->SetPrototype(*value)); | 85 CALL_HEAP_FUNCTION_VOID(func->SetPrototype(*value)); |
86 } | 86 } |
87 | 87 |
88 | 88 |
| 89 static int ExpectedNofPropertiesFromEstimate(int estimate) { |
| 90 // TODO(1231235): We need dynamic feedback to estimate the number |
| 91 // of expected properties in an object. The static hack below |
| 92 // is barely a solution. |
| 93 if (estimate == 0) return 4; |
| 94 return estimate + 2; |
| 95 } |
| 96 |
| 97 |
89 void SetExpectedNofPropertiesFromEstimate(Handle<SharedFunctionInfo> shared, | 98 void SetExpectedNofPropertiesFromEstimate(Handle<SharedFunctionInfo> shared, |
90 int estimate) { | 99 int estimate) { |
91 // TODO(1231235): We need dynamic feedback to estimate the number | 100 shared->set_expected_nof_properties( |
92 // of expected properties in an object. The static hack below | 101 ExpectedNofPropertiesFromEstimate(estimate)); |
93 // is barely a solution. | |
94 shared->set_expected_nof_properties(estimate + 2); | |
95 } | 102 } |
96 | 103 |
97 | 104 |
98 void SetExpectedNofPropertiesFromEstimate(Handle<JSFunction> func, | 105 void SetExpectedNofPropertiesFromEstimate(Handle<JSFunction> func, |
99 int estimate) { | 106 int estimate) { |
100 // TODO(1231235): We need dynamic feedback to estimate the number | 107 SetExpectedNofProperties( |
101 // of expected properties in an object. The static hack below | 108 func, ExpectedNofPropertiesFromEstimate(estimate)); |
102 // is barely a solution. | |
103 SetExpectedNofProperties(func, estimate + 2); | |
104 } | 109 } |
105 | 110 |
106 | 111 |
107 void NormalizeProperties(Handle<JSObject> object) { | 112 void NormalizeProperties(Handle<JSObject> object) { |
108 CALL_HEAP_FUNCTION_VOID(object->NormalizeProperties()); | 113 CALL_HEAP_FUNCTION_VOID(object->NormalizeProperties()); |
109 } | 114 } |
110 | 115 |
111 | 116 |
112 void NormalizeElements(Handle<JSObject> object) { | 117 void NormalizeElements(Handle<JSObject> object) { |
113 CALL_HEAP_FUNCTION_VOID(object->NormalizeElements()); | 118 CALL_HEAP_FUNCTION_VOID(object->NormalizeElements()); |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 Handle<Context> security_context) { | 549 Handle<Context> security_context) { |
545 Handle<FixedArray> arr = Factory::NewFixedArray(4); | 550 Handle<FixedArray> arr = Factory::NewFixedArray(4); |
546 arr->set(0, Smi::FromInt(index)); | 551 arr->set(0, Smi::FromInt(index)); |
547 arr->set(1, *compile_context); // Compile in this context | 552 arr->set(1, *compile_context); // Compile in this context |
548 arr->set(2, *function_context); // Set function context to this | 553 arr->set(2, *function_context); // Set function context to this |
549 arr->set(3, *security_context); // Receiver for call | 554 arr->set(3, *security_context); // Receiver for call |
550 fun->shared()->set_lazy_load_data(*arr); | 555 fun->shared()->set_lazy_load_data(*arr); |
551 } | 556 } |
552 | 557 |
553 } } // namespace v8::internal | 558 } } // namespace v8::internal |
OLD | NEW |