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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 RecordCodeGeneration(*new_object, &masm); | 121 RecordCodeGeneration(*new_object, &masm); |
122 FinishCode(*new_object); | 122 FinishCode(*new_object); |
123 | 123 |
124 // Update the dictionary and the root in Heap. | 124 // Update the dictionary and the root in Heap. |
125 Handle<NumberDictionary> dict = | 125 Handle<NumberDictionary> dict = |
126 factory->DictionaryAtNumberPut( | 126 factory->DictionaryAtNumberPut( |
127 Handle<NumberDictionary>(heap->code_stubs()), | 127 Handle<NumberDictionary>(heap->code_stubs()), |
128 GetKey(), | 128 GetKey(), |
129 new_object); | 129 new_object); |
130 heap->public_set_code_stubs(*dict); | 130 heap->public_set_code_stubs(*dict); |
131 | |
132 code = *new_object; | 131 code = *new_object; |
| 132 Activate(code); |
133 } | 133 } |
134 | 134 |
135 ASSERT(!NeedsImmovableCode() || heap->lo_space()->Contains(code)); | 135 ASSERT(!NeedsImmovableCode() || heap->lo_space()->Contains(code)); |
136 return Handle<Code>(code, isolate); | 136 return Handle<Code>(code, isolate); |
137 } | 137 } |
138 | 138 |
139 | 139 |
140 MaybeObject* CodeStub::TryGetCode() { | 140 MaybeObject* CodeStub::TryGetCode() { |
141 Code* code; | 141 Code* code; |
142 if (!FindCodeInCache(&code)) { | 142 if (!FindCodeInCache(&code)) { |
(...skipping 17 matching lines...) Expand all Loading... |
160 } | 160 } |
161 code = Code::cast(new_object); | 161 code = Code::cast(new_object); |
162 RecordCodeGeneration(code, &masm); | 162 RecordCodeGeneration(code, &masm); |
163 FinishCode(code); | 163 FinishCode(code); |
164 | 164 |
165 // Try to update the code cache but do not fail if unable. | 165 // Try to update the code cache but do not fail if unable. |
166 MaybeObject* maybe_new_object = | 166 MaybeObject* maybe_new_object = |
167 heap->code_stubs()->AtNumberPut(GetKey(), code); | 167 heap->code_stubs()->AtNumberPut(GetKey(), code); |
168 if (maybe_new_object->ToObject(&new_object)) { | 168 if (maybe_new_object->ToObject(&new_object)) { |
169 heap->public_set_code_stubs(NumberDictionary::cast(new_object)); | 169 heap->public_set_code_stubs(NumberDictionary::cast(new_object)); |
| 170 } else if (MustBeInStubCache()) { |
| 171 return maybe_new_object; |
170 } | 172 } |
| 173 |
| 174 Activate(code); |
171 } | 175 } |
172 | 176 |
173 return code; | 177 return code; |
174 } | 178 } |
175 | 179 |
176 | 180 |
177 const char* CodeStub::MajorName(CodeStub::Major major_key, | 181 const char* CodeStub::MajorName(CodeStub::Major major_key, |
178 bool allow_unknown_keys) { | 182 bool allow_unknown_keys) { |
179 switch (major_key) { | 183 switch (major_key) { |
180 #define DEF_CASE(name) case name: return #name "Stub"; | 184 #define DEF_CASE(name) case name: return #name "Stub"; |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 } | 401 } |
398 | 402 |
399 | 403 |
400 bool ToBooleanStub::Types::CanBeUndetectable() const { | 404 bool ToBooleanStub::Types::CanBeUndetectable() const { |
401 return Contains(ToBooleanStub::SPEC_OBJECT) | 405 return Contains(ToBooleanStub::SPEC_OBJECT) |
402 || Contains(ToBooleanStub::STRING); | 406 || Contains(ToBooleanStub::STRING); |
403 } | 407 } |
404 | 408 |
405 | 409 |
406 } } // namespace v8::internal | 410 } } // namespace v8::internal |
OLD | NEW |