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

Side by Side Diff: src/codegen.cc

Issue 115744: This patch much improves our tracking of whether function is... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 7 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
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 ASSERT(!Top::has_pending_exception()); 163 ASSERT(!Top::has_pending_exception());
164 return Handle<Code>::null(); 164 return Handle<Code>::null();
165 } 165 }
166 166
167 // Allocate and install the code. Time the rest of this function as 167 // Allocate and install the code. Time the rest of this function as
168 // code creation. 168 // code creation.
169 HistogramTimerScope timer(&Counters::code_creation); 169 HistogramTimerScope timer(&Counters::code_creation);
170 CodeDesc desc; 170 CodeDesc desc;
171 cgen.masm()->GetCode(&desc); 171 cgen.masm()->GetCode(&desc);
172 ZoneScopeInfo sinfo(flit->scope()); 172 ZoneScopeInfo sinfo(flit->scope());
173 Code::Flags flags = Code::ComputeFlags(Code::FUNCTION); 173 InlineCacheInLoop in_loop =
174 (cgen.loop_nesting() != 0) ? IN_LOOP : NOT_IN_LOOP;
175 Code::Flags flags = Code::ComputeFlags(Code::FUNCTION, in_loop);
174 Handle<Code> code = Factory::NewCode(desc, 176 Handle<Code> code = Factory::NewCode(desc,
175 &sinfo, 177 &sinfo,
176 flags, 178 flags,
177 cgen.masm()->CodeObject()); 179 cgen.masm()->CodeObject());
178 180
179 // Add unresolved entries in the code to the fixup list. 181 // Add unresolved entries in the code to the fixup list.
180 Bootstrapper::AddFixup(*code, cgen.masm()); 182 Bootstrapper::AddFixup(*code, cgen.masm());
181 183
182 #ifdef ENABLE_DISASSEMBLER 184 #ifdef ENABLE_DISASSEMBLER
183 if (print_code) { 185 if (print_code) {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 #endif 317 #endif
316 318
317 // Set the expected number of properties for instances and return 319 // Set the expected number of properties for instances and return
318 // the resulting function. 320 // the resulting function.
319 SetExpectedNofPropertiesFromEstimate(function, 321 SetExpectedNofPropertiesFromEstimate(function,
320 node->expected_property_count()); 322 node->expected_property_count());
321 return function; 323 return function;
322 } 324 }
323 325
324 326
325 Handle<Code> CodeGenerator::ComputeCallInitialize(int argc) { 327 Handle<Code> CodeGenerator::ComputeCallInitialize(
326 CALL_HEAP_FUNCTION(StubCache::ComputeCallInitialize(argc), Code); 328 int argc,
327 } 329 InlineCacheInLoop in_loop) {
328 330 if (in_loop) {
Kevin Millikin (Chromium) 2009/05/25 11:00:42 My opinion is mixed about making these two value,
329 331 // Force the creation of the corresponding stub outside loops,
330 Handle<Code> CodeGenerator::ComputeCallInitializeInLoop(int argc) { 332 // because it may be used when clearing the ICs later - it is
331 // Force the creation of the corresponding stub outside loops, 333 // possible for a series of IC transitions to lose the in-loop
332 // because it will be used when clearing the ICs later - when we 334 // information, and the IC clearing code can't generate a stub
333 // don't know if we're inside a loop or not. 335 // that it needs so we need to ensure it is generated already.
334 ComputeCallInitialize(argc); 336 ComputeCallInitialize(argc, NOT_IN_LOOP);
335 CALL_HEAP_FUNCTION(StubCache::ComputeCallInitializeInLoop(argc), Code); 337 }
338 CALL_HEAP_FUNCTION(StubCache::ComputeCallInitialize(argc, in_loop), Code);
336 } 339 }
337 340
338 341
339 void CodeGenerator::ProcessDeclarations(ZoneList<Declaration*>* declarations) { 342 void CodeGenerator::ProcessDeclarations(ZoneList<Declaration*>* declarations) {
340 int length = declarations->length(); 343 int length = declarations->length();
341 int globals = 0; 344 int globals = 0;
342 for (int i = 0; i < length; i++) { 345 for (int i = 0; i < length; i++) {
343 Declaration* node = declarations->at(i); 346 Declaration* node = declarations->at(i);
344 Variable* var = node->proxy()->var(); 347 Variable* var = node->proxy()->var();
345 Slot* slot = var->slot(); 348 Slot* slot = var->slot();
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 void ArgumentsAccessStub::Generate(MacroAssembler* masm) { 635 void ArgumentsAccessStub::Generate(MacroAssembler* masm) {
633 switch (type_) { 636 switch (type_) {
634 case READ_LENGTH: GenerateReadLength(masm); break; 637 case READ_LENGTH: GenerateReadLength(masm); break;
635 case READ_ELEMENT: GenerateReadElement(masm); break; 638 case READ_ELEMENT: GenerateReadElement(masm); break;
636 case NEW_OBJECT: GenerateNewObject(masm); break; 639 case NEW_OBJECT: GenerateNewObject(masm); break;
637 } 640 }
638 } 641 }
639 642
640 643
641 } } // namespace v8::internal 644 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698