| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 char buffer[100]; | 66 char buffer[100]; |
| 67 NoAllocationStringAllocator allocator(buffer, | 67 NoAllocationStringAllocator allocator(buffer, |
| 68 static_cast<unsigned>(sizeof(buffer))); | 68 static_cast<unsigned>(sizeof(buffer))); |
| 69 StringStream stream(&allocator); | 69 StringStream stream(&allocator); |
| 70 PrintName(&stream); | 70 PrintName(&stream); |
| 71 return stream.ToCString(); | 71 return stream.ToCString(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 | 74 |
| 75 void CodeStub::RecordCodeGeneration(Code* code, MacroAssembler* masm) { | 75 void CodeStub::RecordCodeGeneration(Code* code, MacroAssembler* masm) { |
| 76 code->set_major_key(MajorKey()); | |
| 77 | |
| 78 Isolate* isolate = masm->isolate(); | 76 Isolate* isolate = masm->isolate(); |
| 79 SmartArrayPointer<const char> name = GetName(); | 77 SmartArrayPointer<const char> name = GetName(); |
| 80 PROFILE(isolate, CodeCreateEvent(Logger::STUB_TAG, code, *name)); | 78 PROFILE(isolate, CodeCreateEvent(Logger::STUB_TAG, code, *name)); |
| 81 GDBJIT(AddCode(GDBJITInterface::STUB, *name, code)); | 79 GDBJIT(AddCode(GDBJITInterface::STUB, *name, code)); |
| 82 Counters* counters = isolate->counters(); | 80 Counters* counters = isolate->counters(); |
| 83 counters->total_stubs_code_size()->Increment(code->instruction_size()); | 81 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 } | 82 } |
| 92 | 83 |
| 93 | 84 |
| 94 int CodeStub::GetCodeKind() { | 85 int CodeStub::GetCodeKind() { |
| 95 return Code::STUB; | 86 return Code::STUB; |
| 96 } | 87 } |
| 97 | 88 |
| 98 | 89 |
| 99 Handle<Code> CodeStub::GetCode() { | 90 Handle<Code> CodeStub::GetCode() { |
| 100 Isolate* isolate = Isolate::Current(); | 91 Isolate* isolate = Isolate::Current(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 118 // Create the code object. | 109 // Create the code object. |
| 119 CodeDesc desc; | 110 CodeDesc desc; |
| 120 masm.GetCode(&desc); | 111 masm.GetCode(&desc); |
| 121 | 112 |
| 122 // Copy the generated code into a heap object. | 113 // Copy the generated code into a heap object. |
| 123 Code::Flags flags = Code::ComputeFlags( | 114 Code::Flags flags = Code::ComputeFlags( |
| 124 static_cast<Code::Kind>(GetCodeKind()), | 115 static_cast<Code::Kind>(GetCodeKind()), |
| 125 GetICState()); | 116 GetICState()); |
| 126 Handle<Code> new_object = factory->NewCode( | 117 Handle<Code> new_object = factory->NewCode( |
| 127 desc, flags, masm.CodeObject(), NeedsImmovableCode()); | 118 desc, flags, masm.CodeObject(), NeedsImmovableCode()); |
| 119 new_object->set_major_key(MajorKey()); |
| 120 FinishCode(new_object); |
| 128 RecordCodeGeneration(*new_object, &masm); | 121 RecordCodeGeneration(*new_object, &masm); |
| 129 FinishCode(new_object); | 122 |
| 123 #ifdef ENABLE_DISASSEMBLER |
| 124 if (FLAG_print_code_stubs) { |
| 125 new_object->Disassemble(*GetName()); |
| 126 PrintF("\n"); |
| 127 } |
| 128 #endif |
| 130 | 129 |
| 131 if (UseSpecialCache()) { | 130 if (UseSpecialCache()) { |
| 132 AddToSpecialCache(new_object); | 131 AddToSpecialCache(new_object); |
| 133 } else { | 132 } else { |
| 134 // Update the dictionary and the root in Heap. | 133 // Update the dictionary and the root in Heap. |
| 135 Handle<UnseededNumberDictionary> dict = | 134 Handle<UnseededNumberDictionary> dict = |
| 136 factory->DictionaryAtNumberPut( | 135 factory->DictionaryAtNumberPut( |
| 137 Handle<UnseededNumberDictionary>(heap->code_stubs()), | 136 Handle<UnseededNumberDictionary>(heap->code_stubs()), |
| 138 GetKey(), | 137 GetKey(), |
| 139 new_object); | 138 new_object); |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 grow_mode_); | 450 grow_mode_); |
| 452 } else { | 451 } else { |
| 453 UNREACHABLE(); | 452 UNREACHABLE(); |
| 454 } | 453 } |
| 455 } | 454 } |
| 456 masm->bind(&fail); | 455 masm->bind(&fail); |
| 457 KeyedStoreIC::GenerateRuntimeSetProperty(masm, strict_mode_); | 456 KeyedStoreIC::GenerateRuntimeSetProperty(masm, strict_mode_); |
| 458 } | 457 } |
| 459 | 458 |
| 460 } } // namespace v8::internal | 459 } } // namespace v8::internal |
| OLD | NEW |