Home | History | Annotate | Download | only in src

Lines Matching defs:code

6 //     * Redistributions of source code must retain the above copyright
31 #include "code-stubs.h"
39 bool CodeStub::FindCodeInCache(Code** code_out) {
43 *code_out = Code::cast(heap->code_stubs()->ValueAt(index));
51 // Update the static counter each time a new code stub is generated.
57 // Generate the code for the stub.
63 void CodeStub::RecordCodeGeneration(Code* code, MacroAssembler* masm) {
64 code->set_major_key(MajorKey());
67 PROFILE(isolate, CodeCreateEvent(Logger::STUB_TAG, code, GetName()));
68 GDBJIT(AddCode(GDBJITInterface::STUB, GetName(), code));
70 counters->total_stubs_code_size()->Increment(code->instruction_size());
77 code->Disassemble(GetName());
85 return Code::STUB;
89 Handle<Code> CodeStub::GetCode() {
93 Code* code;
94 if (!FindCodeInCache(&code)) {
97 // Generate the new code.
101 // Create the code object.
105 // Copy the generated code into a heap object.
106 Code::Flags flags = Code::ComputeFlags(
107 static_cast<Code::Kind>(GetCodeKind()),
110 Handle<Code> new_object = factory->NewCode(
123 code = *new_object;
126 ASSERT(!NeedsImmovableCode() || heap->lo_space()->Contains(code));
127 return Handle<Code>(code, isolate);
132 Code* code;
133 if (!FindCodeInCache(&code)) {
134 // Generate the new code.
139 // Create the code object.
143 // Try to copy the generated code into a heap object.
144 Code::Flags flags = Code::ComputeFlags(
145 static_cast<Code::Kind>(GetCodeKind()),
153 code = Code::cast(new_object);
154 RecordCodeGeneration(code, &masm);
155 FinishCode(code);
157 // Try to update the code cache but do not fail if unable.
159 heap->code_stubs()->AtNumberPut(GetKey(), code);
165 return code;