Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 | 74 |
| 75 void CodeStub::RecordCodeGeneration(Code* code, MacroAssembler* masm) { | 75 void CodeStub::RecordCodeGeneration(Code* code, MacroAssembler* masm) { |
| 76 code->set_major_key(MajorKey()); | 76 code->set_major_key(MajorKey()); |
| 77 | 77 |
| 78 Isolate* isolate = masm->isolate(); | 78 Isolate* isolate = masm->isolate(); |
| 79 SmartArrayPointer<const char> name = GetName(); | 79 SmartArrayPointer<const char> name = GetName(); |
| 80 PROFILE(isolate, CodeCreateEvent(Logger::STUB_TAG, code, *name)); | 80 PROFILE(isolate, CodeCreateEvent(Logger::STUB_TAG, code, *name)); |
| 81 GDBJIT(AddCode(GDBJITInterface::STUB, *name, code)); | 81 GDBJIT(AddCode(GDBJITInterface::STUB, *name, code)); |
| 82 Counters* counters = isolate->counters(); | 82 Counters* counters = isolate->counters(); |
| 83 counters->total_stubs_code_size()->Increment(code->instruction_size()); | 83 counters->total_stubs_code_size()->Increment(code->instruction_size()); |
| 84 | |
| 85 #ifdef ENABLE_DISASSEMBLER | |
| 86 if (FLAG_print_code_stubs) { | |
| 87 code->Disassemble(*name); | |
| 88 PrintF("\n"); | |
| 89 } | |
| 90 #endif | |
| 91 } | 84 } |
| 92 | 85 |
| 93 | 86 |
| 94 int CodeStub::GetCodeKind() { | 87 int CodeStub::GetCodeKind() { |
| 95 return Code::STUB; | 88 return Code::STUB; |
| 96 } | 89 } |
| 97 | 90 |
| 98 | 91 |
| 99 Handle<Code> CodeStub::GetCode() { | 92 Handle<Code> CodeStub::GetCode() { |
| 100 Isolate* isolate = Isolate::Current(); | 93 Isolate* isolate = Isolate::Current(); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 118 // Create the code object. | 111 // Create the code object. |
| 119 CodeDesc desc; | 112 CodeDesc desc; |
| 120 masm.GetCode(&desc); | 113 masm.GetCode(&desc); |
| 121 | 114 |
| 122 // Copy the generated code into a heap object. | 115 // Copy the generated code into a heap object. |
| 123 Code::Flags flags = Code::ComputeFlags( | 116 Code::Flags flags = Code::ComputeFlags( |
| 124 static_cast<Code::Kind>(GetCodeKind()), | 117 static_cast<Code::Kind>(GetCodeKind()), |
| 125 GetICState()); | 118 GetICState()); |
| 126 Handle<Code> new_object = factory->NewCode( | 119 Handle<Code> new_object = factory->NewCode( |
| 127 desc, flags, masm.CodeObject(), NeedsImmovableCode()); | 120 desc, flags, masm.CodeObject(), NeedsImmovableCode()); |
| 128 RecordCodeGeneration(*new_object, &masm); | 121 RecordCodeGeneration(*new_object, &masm); |
|
Vyacheslav Egorov (Chromium)
2012/04/26 15:39:51
I think more logical would be to move code->set_ma
Michael Starzinger
2012/04/26 16:19:58
Done. But I still left the printing here. Because
| |
| 129 FinishCode(new_object); | 122 FinishCode(new_object); |
| 130 | 123 |
| 124 #ifdef ENABLE_DISASSEMBLER | |
| 125 if (FLAG_print_code_stubs) { | |
| 126 new_object->Disassemble(*GetName()); | |
| 127 PrintF("\n"); | |
| 128 } | |
| 129 #endif | |
| 130 | |
| 131 if (UseSpecialCache()) { | 131 if (UseSpecialCache()) { |
| 132 AddToSpecialCache(new_object); | 132 AddToSpecialCache(new_object); |
| 133 } else { | 133 } else { |
| 134 // Update the dictionary and the root in Heap. | 134 // Update the dictionary and the root in Heap. |
| 135 Handle<UnseededNumberDictionary> dict = | 135 Handle<UnseededNumberDictionary> dict = |
| 136 factory->DictionaryAtNumberPut( | 136 factory->DictionaryAtNumberPut( |
| 137 Handle<UnseededNumberDictionary>(heap->code_stubs()), | 137 Handle<UnseededNumberDictionary>(heap->code_stubs()), |
| 138 GetKey(), | 138 GetKey(), |
| 139 new_object); | 139 new_object); |
| 140 heap->public_set_code_stubs(*dict); | 140 heap->public_set_code_stubs(*dict); |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 451 grow_mode_); | 451 grow_mode_); |
| 452 } else { | 452 } else { |
| 453 UNREACHABLE(); | 453 UNREACHABLE(); |
| 454 } | 454 } |
| 455 } | 455 } |
| 456 masm->bind(&fail); | 456 masm->bind(&fail); |
| 457 KeyedStoreIC::GenerateRuntimeSetProperty(masm, strict_mode_); | 457 KeyedStoreIC::GenerateRuntimeSetProperty(masm, strict_mode_); |
| 458 } | 458 } |
| 459 | 459 |
| 460 } } // namespace v8::internal | 460 } } // namespace v8::internal |
| OLD | NEW |