Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(911)

Side by Side Diff: src/codegen.cc

Issue 14307006: Make it possible to Crankshaft all kinds of stubs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/compiler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } 99 }
100 100
101 101
102 Handle<Code> CodeGenerator::MakeCodeEpilogue(MacroAssembler* masm, 102 Handle<Code> CodeGenerator::MakeCodeEpilogue(MacroAssembler* masm,
103 Code::Flags flags, 103 Code::Flags flags,
104 CompilationInfo* info) { 104 CompilationInfo* info) {
105 Isolate* isolate = info->isolate(); 105 Isolate* isolate = info->isolate();
106 106
107 // Allocate and install the code. 107 // Allocate and install the code.
108 CodeDesc desc; 108 CodeDesc desc;
109 bool is_crankshafted =
110 Code::ExtractKindFromFlags(flags) == Code::OPTIMIZED_FUNCTION ||
111 info->IsStub();
109 masm->GetCode(&desc); 112 masm->GetCode(&desc);
110 Handle<Code> code = 113 Handle<Code> code =
111 isolate->factory()->NewCode(desc, flags, masm->CodeObject()); 114 isolate->factory()->NewCode(desc, flags, masm->CodeObject(),
112 115 false, is_crankshafted);
113 if (!code.is_null()) { 116 if (!code.is_null()) {
114 isolate->counters()->total_compiled_code_size()->Increment( 117 isolate->counters()->total_compiled_code_size()->Increment(
115 code->instruction_size()); 118 code->instruction_size());
116 code->set_prologue_offset(info->prologue_offset()); 119 code->set_prologue_offset(info->prologue_offset());
117 } 120 }
118 return code; 121 return code;
119 } 122 }
120 123
121 124
122 void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) { 125 void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) {
123 #ifdef ENABLE_DISASSEMBLER 126 #ifdef ENABLE_DISASSEMBLER
124 bool print_code = Isolate::Current()->bootstrapper()->IsActive() 127 bool print_code = Isolate::Current()->bootstrapper()->IsActive()
125 ? FLAG_print_builtin_code 128 ? FLAG_print_builtin_code
126 : (FLAG_print_code || 129 : (FLAG_print_code ||
127 (info->IsStub() && FLAG_print_code_stubs) || 130 (info->IsStub() && FLAG_print_code_stubs) ||
128 (info->IsOptimizing() && FLAG_print_opt_code)); 131 (info->IsOptimizing() && FLAG_print_opt_code));
129 if (print_code) { 132 if (print_code) {
130 // Print the source code if available. 133 // Print the source code if available.
131 FunctionLiteral* function = info->function(); 134 FunctionLiteral* function = info->function();
132 if (code->kind() != Code::COMPILED_STUB) { 135 if (code->kind() == Code::OPTIMIZED_FUNCTION) {
133 Handle<Script> script = info->script(); 136 Handle<Script> script = info->script();
134 if (!script->IsUndefined() && !script->source()->IsUndefined()) { 137 if (!script->IsUndefined() && !script->source()->IsUndefined()) {
135 PrintF("--- Raw source ---\n"); 138 PrintF("--- Raw source ---\n");
136 ConsStringIteratorOp op; 139 ConsStringIteratorOp op;
137 StringCharacterStream stream(String::cast(script->source()), 140 StringCharacterStream stream(String::cast(script->source()),
138 &op, 141 &op,
139 function->start_position()); 142 function->start_position());
140 // fun->end_position() points to the last character in the stream. We 143 // fun->end_position() points to the last character in the stream. We
141 // need to compensate by adding one to calculate the length. 144 // need to compensate by adding one to calculate the length.
142 int source_len = 145 int source_len =
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 ASSERT(result_size_ == 1 || result_size_ == 2); 224 ASSERT(result_size_ == 1 || result_size_ == 2);
222 #ifdef _WIN64 225 #ifdef _WIN64
223 return result | ((result_size_ == 1) ? 0 : 2); 226 return result | ((result_size_ == 1) ? 0 : 2);
224 #else 227 #else
225 return result; 228 return result;
226 #endif 229 #endif
227 } 230 }
228 231
229 232
230 } } // namespace v8::internal 233 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698