OLD | NEW |
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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 SetFunctionPosition(function()); | 142 SetFunctionPosition(function()); |
143 Comment cmnt(masm_, "[ function compiled by full code generator"); | 143 Comment cmnt(masm_, "[ function compiled by full code generator"); |
144 | 144 |
145 #ifdef DEBUG | 145 #ifdef DEBUG |
146 if (strlen(FLAG_stop_at) > 0 && | 146 if (strlen(FLAG_stop_at) > 0 && |
147 info->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { | 147 info->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { |
148 __ stop("stop-at"); | 148 __ stop("stop-at"); |
149 } | 149 } |
150 #endif | 150 #endif |
151 | 151 |
| 152 // We can optionally optimize based on counters rather than statistical |
| 153 // sampling. |
| 154 if (info->ShouldSelfOptimize()) { |
| 155 if (FLAG_trace_opt) { |
| 156 PrintF("[adding self-optimization header to %s]\n", |
| 157 *info->function()->debug_name()->ToCString()); |
| 158 } |
| 159 MaybeObject* maybe_cell = isolate()->heap()->AllocateJSGlobalPropertyCell( |
| 160 Smi::FromInt(Compiler::kCallsUntilPrimitiveOpt)); |
| 161 JSGlobalPropertyCell* cell; |
| 162 if (maybe_cell->To(&cell)) { |
| 163 __ li(a2, Handle<JSGlobalPropertyCell>(cell)); |
| 164 __ lw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset)); |
| 165 __ Subu(a3, a3, Operand(Smi::FromInt(1))); |
| 166 __ sw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset)); |
| 167 Handle<Code> compile_stub( |
| 168 isolate()->builtins()->builtin(Builtins::kLazyRecompile)); |
| 169 __ Jump(compile_stub, RelocInfo::CODE_TARGET, eq, a3, Operand(zero_reg)); |
| 170 } |
| 171 } |
| 172 |
152 // Strict mode functions and builtins need to replace the receiver | 173 // Strict mode functions and builtins need to replace the receiver |
153 // with undefined when called as functions (without an explicit | 174 // with undefined when called as functions (without an explicit |
154 // receiver object). t1 is zero for method calls and non-zero for | 175 // receiver object). t1 is zero for method calls and non-zero for |
155 // function calls. | 176 // function calls. |
156 if (!info->is_classic_mode() || info->is_native()) { | 177 if (!info->is_classic_mode() || info->is_native()) { |
157 Label ok; | 178 Label ok; |
158 __ Branch(&ok, eq, t1, Operand(zero_reg)); | 179 __ Branch(&ok, eq, t1, Operand(zero_reg)); |
159 int receiver_offset = info->scope()->num_parameters() * kPointerSize; | 180 int receiver_offset = info->scope()->num_parameters() * kPointerSize; |
160 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); | 181 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); |
161 __ sw(a2, MemOperand(sp, receiver_offset)); | 182 __ sw(a2, MemOperand(sp, receiver_offset)); |
(...skipping 4277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4439 *context_length = 0; | 4460 *context_length = 0; |
4440 return previous_; | 4461 return previous_; |
4441 } | 4462 } |
4442 | 4463 |
4443 | 4464 |
4444 #undef __ | 4465 #undef __ |
4445 | 4466 |
4446 } } // namespace v8::internal | 4467 } } // namespace v8::internal |
4447 | 4468 |
4448 #endif // V8_TARGET_ARCH_MIPS | 4469 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |