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

Side by Side Diff: src/ia32/full-codegen-ia32.cc

Issue 9361026: Count-based profiling for primitive functions (hidden behind a flag) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 10 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 2011 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
11 // with the distribution. 11 // with the distribution.
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 SetFunctionPosition(function()); 122 SetFunctionPosition(function());
123 Comment cmnt(masm_, "[ function compiled by full code generator"); 123 Comment cmnt(masm_, "[ function compiled by full code generator");
124 124
125 #ifdef DEBUG 125 #ifdef DEBUG
126 if (strlen(FLAG_stop_at) > 0 && 126 if (strlen(FLAG_stop_at) > 0 &&
127 info->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { 127 info->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) {
128 __ int3(); 128 __ int3();
129 } 129 }
130 #endif 130 #endif
131 131
132 // Primitive functions are unlikely to be picked up by the stack-walking
133 // profiler, so they trigger their own optimization when they're called
134 // for the SharedFunctionInfo::kCallsUntilPrimitiveOptimization-th time.
135 if (FLAG_counting_profiler &&
Erik Corry 2012/02/08 14:09:23 These two flags can be tested inside ShouldSelfOpt
Jakob Kummerow 2012/02/08 15:24:08 Good idea to clean this up. I've moved ShouldSelfO
136 FLAG_crankshaft &&
137 info->function()->ShouldSelfOptimize() &&
138 !Serializer::enabled() &&
139 !(!info->shared_info().is_null() &&
140 info->shared_info()->optimization_disabled())) {
141 if (FLAG_trace_opt) {
142 PrintF("[adding self-optimization header to %s]\n",
143 *info->function()->debug_name()->ToCString());
144 }
145 MaybeObject* maybe_cell = isolate()->heap()->AllocateJSGlobalPropertyCell(
146 Smi::FromInt(Compiler::kCallsUntilPrimitiveOpt));
147 JSGlobalPropertyCell* cell;
148 if (maybe_cell->To(&cell)) {
149 __ mov(eax, Immediate(Handle<JSGlobalPropertyCell>(cell)));
150 __ sub(FieldOperand(eax, JSGlobalPropertyCell::kValueOffset),
151 Immediate(Smi::FromInt(1)));
Erik Corry 2012/02/08 14:09:23 It seems you can do: __ sub(Operand::Cell(Handle<
Jakob Kummerow 2012/02/08 15:24:08 Done.
152 Handle<Code> compile_stub(
153 isolate()->builtins()->builtin(Builtins::kLazyRecompile));
154 __ j(zero, compile_stub);
Erik Corry 2012/02/08 14:09:23 There is an assumption here that the Smi tag is ze
Jakob Kummerow 2012/02/08 15:24:08 I've added an ASSERT for the Smi tag. I can't easi
155 }
156 }
157
132 // Strict mode functions and builtins need to replace the receiver 158 // Strict mode functions and builtins need to replace the receiver
133 // with undefined when called as functions (without an explicit 159 // with undefined when called as functions (without an explicit
134 // receiver object). ecx is zero for method calls and non-zero for 160 // receiver object). ecx is zero for method calls and non-zero for
135 // function calls. 161 // function calls.
136 if (!info->is_classic_mode() || info->is_native()) { 162 if (!info->is_classic_mode() || info->is_native()) {
137 Label ok; 163 Label ok;
138 __ test(ecx, ecx); 164 __ test(ecx, ecx);
139 __ j(zero, &ok, Label::kNear); 165 __ j(zero, &ok, Label::kNear);
140 // +1 for return address. 166 // +1 for return address.
141 int receiver_offset = (info->scope()->num_parameters() + 1) * kPointerSize; 167 int receiver_offset = (info->scope()->num_parameters() + 1) * kPointerSize;
(...skipping 4243 matching lines...) Expand 10 before | Expand all | Expand 10 after
4385 *context_length = 0; 4411 *context_length = 0;
4386 return previous_; 4412 return previous_;
4387 } 4413 }
4388 4414
4389 4415
4390 #undef __ 4416 #undef __
4391 4417
4392 } } // namespace v8::internal 4418 } } // namespace v8::internal
4393 4419
4394 #endif // V8_TARGET_ARCH_IA32 4420 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698