Chromium Code Reviews| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 113 RecordCodeGeneration(*new_object, &masm); | 113 RecordCodeGeneration(*new_object, &masm); |
| 114 FinishCode(*new_object); | 114 FinishCode(*new_object); |
| 115 | 115 |
| 116 // Update the dictionary and the root in Heap. | 116 // Update the dictionary and the root in Heap. |
| 117 Handle<NumberDictionary> dict = | 117 Handle<NumberDictionary> dict = |
| 118 factory->DictionaryAtNumberPut( | 118 factory->DictionaryAtNumberPut( |
| 119 Handle<NumberDictionary>(heap->code_stubs()), | 119 Handle<NumberDictionary>(heap->code_stubs()), |
| 120 GetKey(), | 120 GetKey(), |
| 121 new_object); | 121 new_object); |
| 122 heap->public_set_code_stubs(*dict); | 122 heap->public_set_code_stubs(*dict); |
| 123 | |
| 124 code = *new_object; | 123 code = *new_object; |
| 124 if (MajorKey() == RecordWrite) { | |
| 125 heap->incremental_marking()->ActivateGeneratedStub(code); | |
|
Lasse Reichstein
2011/07/12 06:44:16
Seems like the wrong direction of dependency, to m
Vyacheslav Egorov (Chromium)
2011/07/12 11:17:11
I did not want to introduce two virtual function f
| |
| 126 } | |
| 125 } | 127 } |
| 126 | 128 |
| 127 ASSERT(!NeedsImmovableCode() || heap->lo_space()->Contains(code)); | 129 ASSERT(!NeedsImmovableCode() || heap->lo_space()->Contains(code)); |
| 128 return Handle<Code>(code, isolate); | 130 return Handle<Code>(code, isolate); |
| 129 } | 131 } |
| 130 | 132 |
| 131 | 133 |
| 132 MaybeObject* CodeStub::TryGetCode() { | 134 MaybeObject* CodeStub::TryGetCode() { |
| 133 Code* code; | 135 Code* code; |
| 134 if (!FindCodeInCache(&code)) { | 136 if (!FindCodeInCache(&code)) { |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 153 } | 155 } |
| 154 code = Code::cast(new_object); | 156 code = Code::cast(new_object); |
| 155 RecordCodeGeneration(code, &masm); | 157 RecordCodeGeneration(code, &masm); |
| 156 FinishCode(code); | 158 FinishCode(code); |
| 157 | 159 |
| 158 // Try to update the code cache but do not fail if unable. | 160 // Try to update the code cache but do not fail if unable. |
| 159 MaybeObject* maybe_new_object = | 161 MaybeObject* maybe_new_object = |
| 160 heap->code_stubs()->AtNumberPut(GetKey(), code); | 162 heap->code_stubs()->AtNumberPut(GetKey(), code); |
| 161 if (maybe_new_object->ToObject(&new_object)) { | 163 if (maybe_new_object->ToObject(&new_object)) { |
| 162 heap->public_set_code_stubs(NumberDictionary::cast(new_object)); | 164 heap->public_set_code_stubs(NumberDictionary::cast(new_object)); |
| 165 } else if (MajorKey() == RecordWrite) { | |
|
Lasse Reichstein
2011/07/12 06:44:16
Again, create a virtual function, e.g., MustBeCach
Vyacheslav Egorov (Chromium)
2011/07/12 11:17:11
Done.
| |
| 166 // All RecordWrite stubs have to be registered in the stub cache. | |
| 167 return maybe_new_object; | |
| 168 } | |
| 169 | |
| 170 // If this is a RecordWrite stub we need to patch it to ensure correct state . | |
| 171 if (MajorKey() == RecordWrite) { | |
| 172 heap->incremental_marking()->ActivateGeneratedStub(code); | |
|
Lasse Reichstein
2011/07/12 06:44:16
And again.
Vyacheslav Egorov (Chromium)
2011/07/12 11:17:11
Done.
| |
| 163 } | 173 } |
| 164 } | 174 } |
| 165 | 175 |
| 166 return code; | 176 return code; |
| 167 } | 177 } |
| 168 | 178 |
| 169 | 179 |
| 170 const char* CodeStub::MajorName(CodeStub::Major major_key, | 180 const char* CodeStub::MajorName(CodeStub::Major major_key, |
| 171 bool allow_unknown_keys) { | 181 bool allow_unknown_keys) { |
| 172 switch (major_key) { | 182 switch (major_key) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 258 KeyedLoadStubCompiler::GenerateLoadExternalArray(masm, array_type_); | 268 KeyedLoadStubCompiler::GenerateLoadExternalArray(masm, array_type_); |
| 259 } | 269 } |
| 260 | 270 |
| 261 | 271 |
| 262 void KeyedStoreExternalArrayStub::Generate(MacroAssembler* masm) { | 272 void KeyedStoreExternalArrayStub::Generate(MacroAssembler* masm) { |
| 263 KeyedStoreStubCompiler::GenerateStoreExternalArray(masm, array_type_); | 273 KeyedStoreStubCompiler::GenerateStoreExternalArray(masm, array_type_); |
| 264 } | 274 } |
| 265 | 275 |
| 266 | 276 |
| 267 } } // namespace v8::internal | 277 } } // namespace v8::internal |
| OLD | NEW |