Lines Matching refs: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.
55 // Generate the code for the stub.
61 void CodeStub::RecordCodeGeneration(Code* code, MacroAssembler* masm) {
62 code->set_major_key(MajorKey());
67 code->instruction_start(),
68 code->instruction_size());
71 LOG(CodeCreateEvent(Logger::STUB_TAG, code, GetName()));
72 Counters::total_stubs_code_size.Increment(code->instruction_size());
79 code->Disassemble(GetName());
86 Handle<Code> CodeStub::GetCode() {
87 Code* code;
88 if (!FindCodeInCache(&code)) {
91 // Generate the new code.
95 // Create the code object.
99 // Copy the generated code into a heap object.
100 Code::Flags flags = Code::ComputeFlags(Code::STUB, InLoop());
101 Handle<Code> new_object =
116 code = *new_object;
119 return Handle<Code>(code);
124 Code* code;
125 if (!FindCodeInCache(&code)) {
126 // Generate the new code.
130 // Create the code object.
134 // Try to copy the generated code into a heap object.
135 Code::Flags flags = Code::ComputeFlags(Code::STUB, InLoop());
139 code = Code::cast(new_object);
140 RecordCodeGeneration(code, &masm);
143 SetCustomCache(code);
145 // Try to update the code cache but do not fail if unable.
146 new_object = Heap::code_stubs()->AtNumberPut(GetKey(), code);
153 return code;