OLD | NEW |
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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 } | 187 } |
188 | 188 |
189 | 189 |
190 void LGoto::PrintDataTo(StringStream* stream) { | 190 void LGoto::PrintDataTo(StringStream* stream) { |
191 stream->Add("B%d", block_id()); | 191 stream->Add("B%d", block_id()); |
192 } | 192 } |
193 | 193 |
194 | 194 |
195 void LBranch::PrintDataTo(StringStream* stream) { | 195 void LBranch::PrintDataTo(StringStream* stream) { |
196 stream->Add("B%d | B%d on ", true_block_id(), false_block_id()); | 196 stream->Add("B%d | B%d on ", true_block_id(), false_block_id()); |
197 value()->PrintTo(stream); | 197 InputAt(0)->PrintTo(stream); |
198 } | 198 } |
199 | 199 |
200 | 200 |
201 void LCmpIDAndBranch::PrintDataTo(StringStream* stream) { | 201 void LCmpIDAndBranch::PrintDataTo(StringStream* stream) { |
202 stream->Add("if "); | 202 stream->Add("if "); |
203 left()->PrintTo(stream); | 203 InputAt(0)->PrintTo(stream); |
204 stream->Add(" %s ", Token::String(op())); | 204 stream->Add(" %s ", Token::String(op())); |
205 right()->PrintTo(stream); | 205 InputAt(1)->PrintTo(stream); |
206 stream->Add(" then B%d else B%d", true_block_id(), false_block_id()); | 206 stream->Add(" then B%d else B%d", true_block_id(), false_block_id()); |
207 } | 207 } |
208 | 208 |
209 | 209 |
210 void LIsNilAndBranch::PrintDataTo(StringStream* stream) { | 210 void LIsNilAndBranch::PrintDataTo(StringStream* stream) { |
211 stream->Add("if "); | 211 stream->Add("if "); |
212 value()->PrintTo(stream); | 212 InputAt(0)->PrintTo(stream); |
213 stream->Add(kind() == kStrictEquality ? " === " : " == "); | 213 stream->Add(kind() == kStrictEquality ? " === " : " == "); |
214 stream->Add(nil() == kNullValue ? "null" : "undefined"); | 214 stream->Add(nil() == kNullValue ? "null" : "undefined"); |
215 stream->Add(" then B%d else B%d", true_block_id(), false_block_id()); | 215 stream->Add(" then B%d else B%d", true_block_id(), false_block_id()); |
216 } | 216 } |
217 | 217 |
218 | 218 |
219 void LIsObjectAndBranch::PrintDataTo(StringStream* stream) { | 219 void LIsObjectAndBranch::PrintDataTo(StringStream* stream) { |
220 stream->Add("if is_object("); | 220 stream->Add("if is_object("); |
221 value()->PrintTo(stream); | 221 InputAt(0)->PrintTo(stream); |
222 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); | 222 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); |
223 } | 223 } |
224 | 224 |
225 | 225 |
226 void LIsStringAndBranch::PrintDataTo(StringStream* stream) { | 226 void LIsStringAndBranch::PrintDataTo(StringStream* stream) { |
227 stream->Add("if is_string("); | 227 stream->Add("if is_string("); |
228 value()->PrintTo(stream); | 228 InputAt(0)->PrintTo(stream); |
229 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); | 229 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); |
230 } | 230 } |
231 | 231 |
232 | 232 |
233 void LIsSmiAndBranch::PrintDataTo(StringStream* stream) { | 233 void LIsSmiAndBranch::PrintDataTo(StringStream* stream) { |
234 stream->Add("if is_smi("); | 234 stream->Add("if is_smi("); |
235 value()->PrintTo(stream); | 235 InputAt(0)->PrintTo(stream); |
236 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); | 236 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); |
237 } | 237 } |
238 | 238 |
239 | 239 |
240 void LIsUndetectableAndBranch::PrintDataTo(StringStream* stream) { | 240 void LIsUndetectableAndBranch::PrintDataTo(StringStream* stream) { |
241 stream->Add("if is_undetectable("); | 241 stream->Add("if is_undetectable("); |
242 value()->PrintTo(stream); | 242 InputAt(0)->PrintTo(stream); |
243 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); | 243 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); |
244 } | 244 } |
245 | 245 |
246 | 246 |
247 void LStringCompareAndBranch::PrintDataTo(StringStream* stream) { | 247 void LStringCompareAndBranch::PrintDataTo(StringStream* stream) { |
248 stream->Add("if string_compare("); | 248 stream->Add("if string_compare("); |
249 left()->PrintTo(stream); | 249 InputAt(0)->PrintTo(stream); |
250 right()->PrintTo(stream); | 250 InputAt(1)->PrintTo(stream); |
251 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); | 251 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); |
252 } | 252 } |
253 | 253 |
254 | 254 |
255 void LHasInstanceTypeAndBranch::PrintDataTo(StringStream* stream) { | 255 void LHasInstanceTypeAndBranch::PrintDataTo(StringStream* stream) { |
256 stream->Add("if has_instance_type("); | 256 stream->Add("if has_instance_type("); |
257 value()->PrintTo(stream); | 257 InputAt(0)->PrintTo(stream); |
258 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); | 258 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); |
259 } | 259 } |
260 | 260 |
261 | 261 |
262 void LHasCachedArrayIndexAndBranch::PrintDataTo(StringStream* stream) { | 262 void LHasCachedArrayIndexAndBranch::PrintDataTo(StringStream* stream) { |
263 stream->Add("if has_cached_array_index("); | 263 stream->Add("if has_cached_array_index("); |
264 value()->PrintTo(stream); | 264 InputAt(0)->PrintTo(stream); |
265 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); | 265 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); |
266 } | 266 } |
267 | 267 |
268 | 268 |
269 void LClassOfTestAndBranch::PrintDataTo(StringStream* stream) { | 269 void LClassOfTestAndBranch::PrintDataTo(StringStream* stream) { |
270 stream->Add("if class_of_test("); | 270 stream->Add("if class_of_test("); |
271 value()->PrintTo(stream); | 271 InputAt(0)->PrintTo(stream); |
272 stream->Add(", \"%o\") then B%d else B%d", | 272 stream->Add(", \"%o\") then B%d else B%d", |
273 *hydrogen()->class_name(), | 273 *hydrogen()->class_name(), |
274 true_block_id(), | 274 true_block_id(), |
275 false_block_id()); | 275 false_block_id()); |
276 } | 276 } |
277 | 277 |
278 | 278 |
279 void LTypeofIsAndBranch::PrintDataTo(StringStream* stream) { | 279 void LTypeofIsAndBranch::PrintDataTo(StringStream* stream) { |
280 stream->Add("if typeof "); | 280 stream->Add("if typeof "); |
281 value()->PrintTo(stream); | 281 InputAt(0)->PrintTo(stream); |
282 stream->Add(" == \"%s\" then B%d else B%d", | 282 stream->Add(" == \"%s\" then B%d else B%d", |
283 *hydrogen()->type_literal()->ToCString(), | 283 *hydrogen()->type_literal()->ToCString(), |
284 true_block_id(), false_block_id()); | 284 true_block_id(), false_block_id()); |
285 } | 285 } |
286 | 286 |
287 | 287 |
288 void LCallConstantFunction::PrintDataTo(StringStream* stream) { | 288 void LCallConstantFunction::PrintDataTo(StringStream* stream) { |
289 stream->Add("#%d / ", arity()); | 289 stream->Add("#%d / ", arity()); |
290 } | 290 } |
291 | 291 |
292 | 292 |
293 void LUnaryMathOperation::PrintDataTo(StringStream* stream) { | 293 void LUnaryMathOperation::PrintDataTo(StringStream* stream) { |
294 stream->Add("/%s ", hydrogen()->OpName()); | 294 stream->Add("/%s ", hydrogen()->OpName()); |
295 value()->PrintTo(stream); | 295 InputAt(0)->PrintTo(stream); |
296 } | 296 } |
297 | 297 |
298 | 298 |
299 void LLoadContextSlot::PrintDataTo(StringStream* stream) { | 299 void LLoadContextSlot::PrintDataTo(StringStream* stream) { |
300 context()->PrintTo(stream); | 300 InputAt(0)->PrintTo(stream); |
301 stream->Add("[%d]", slot_index()); | 301 stream->Add("[%d]", slot_index()); |
302 } | 302 } |
303 | 303 |
304 | 304 |
305 void LStoreContextSlot::PrintDataTo(StringStream* stream) { | 305 void LStoreContextSlot::PrintDataTo(StringStream* stream) { |
306 context()->PrintTo(stream); | 306 InputAt(0)->PrintTo(stream); |
307 stream->Add("[%d] <- ", slot_index()); | 307 stream->Add("[%d] <- ", slot_index()); |
308 value()->PrintTo(stream); | 308 InputAt(1)->PrintTo(stream); |
309 } | 309 } |
310 | 310 |
311 | 311 |
312 void LInvokeFunction::PrintDataTo(StringStream* stream) { | 312 void LInvokeFunction::PrintDataTo(StringStream* stream) { |
313 stream->Add("= "); | 313 stream->Add("= "); |
314 function()->PrintTo(stream); | 314 InputAt(0)->PrintTo(stream); |
315 stream->Add(" #%d / ", arity()); | 315 stream->Add(" #%d / ", arity()); |
316 } | 316 } |
317 | 317 |
318 | 318 |
319 void LCallKeyed::PrintDataTo(StringStream* stream) { | 319 void LCallKeyed::PrintDataTo(StringStream* stream) { |
320 stream->Add("[r2] #%d / ", arity()); | 320 stream->Add("[r2] #%d / ", arity()); |
321 } | 321 } |
322 | 322 |
323 | 323 |
324 void LCallNamed::PrintDataTo(StringStream* stream) { | 324 void LCallNamed::PrintDataTo(StringStream* stream) { |
325 SmartArrayPointer<char> name_string = name()->ToCString(); | 325 SmartArrayPointer<char> name_string = name()->ToCString(); |
326 stream->Add("%s #%d / ", *name_string, arity()); | 326 stream->Add("%s #%d / ", *name_string, arity()); |
327 } | 327 } |
328 | 328 |
329 | 329 |
330 void LCallGlobal::PrintDataTo(StringStream* stream) { | 330 void LCallGlobal::PrintDataTo(StringStream* stream) { |
331 SmartArrayPointer<char> name_string = name()->ToCString(); | 331 SmartArrayPointer<char> name_string = name()->ToCString(); |
332 stream->Add("%s #%d / ", *name_string, arity()); | 332 stream->Add("%s #%d / ", *name_string, arity()); |
333 } | 333 } |
334 | 334 |
335 | 335 |
336 void LCallKnownGlobal::PrintDataTo(StringStream* stream) { | 336 void LCallKnownGlobal::PrintDataTo(StringStream* stream) { |
337 stream->Add("#%d / ", arity()); | 337 stream->Add("#%d / ", arity()); |
338 } | 338 } |
339 | 339 |
340 | 340 |
341 void LCallNew::PrintDataTo(StringStream* stream) { | 341 void LCallNew::PrintDataTo(StringStream* stream) { |
342 stream->Add("= "); | 342 stream->Add("= "); |
343 constructor()->PrintTo(stream); | 343 InputAt(0)->PrintTo(stream); |
344 stream->Add(" #%d / ", arity()); | 344 stream->Add(" #%d / ", arity()); |
345 } | 345 } |
346 | 346 |
347 | 347 |
348 void LAccessArgumentsAt::PrintDataTo(StringStream* stream) { | 348 void LAccessArgumentsAt::PrintDataTo(StringStream* stream) { |
349 arguments()->PrintTo(stream); | 349 arguments()->PrintTo(stream); |
| 350 |
350 stream->Add(" length "); | 351 stream->Add(" length "); |
351 length()->PrintTo(stream); | 352 length()->PrintTo(stream); |
| 353 |
352 stream->Add(" index "); | 354 stream->Add(" index "); |
353 index()->PrintTo(stream); | 355 index()->PrintTo(stream); |
354 } | 356 } |
355 | 357 |
356 | 358 |
357 void LStoreNamedField::PrintDataTo(StringStream* stream) { | 359 void LStoreNamedField::PrintDataTo(StringStream* stream) { |
358 object()->PrintTo(stream); | 360 object()->PrintTo(stream); |
359 stream->Add("."); | 361 stream->Add("."); |
360 stream->Add(*String::cast(*name())->ToCString()); | 362 stream->Add(*String::cast(*name())->ToCString()); |
361 stream->Add(" <- "); | 363 stream->Add(" <- "); |
(...skipping 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2118 | 2120 |
2119 LInstruction* LChunkBuilder::DoDeleteProperty(HDeleteProperty* instr) { | 2121 LInstruction* LChunkBuilder::DoDeleteProperty(HDeleteProperty* instr) { |
2120 LOperand* object = UseFixed(instr->object(), r0); | 2122 LOperand* object = UseFixed(instr->object(), r0); |
2121 LOperand* key = UseFixed(instr->key(), r1); | 2123 LOperand* key = UseFixed(instr->key(), r1); |
2122 LDeleteProperty* result = new(zone()) LDeleteProperty(object, key); | 2124 LDeleteProperty* result = new(zone()) LDeleteProperty(object, key); |
2123 return MarkAsCall(DefineFixed(result, r0), instr); | 2125 return MarkAsCall(DefineFixed(result, r0), instr); |
2124 } | 2126 } |
2125 | 2127 |
2126 | 2128 |
2127 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { | 2129 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { |
2128 ASSERT(argument_count_ == 0); | |
2129 allocator_->MarkAsOsrEntry(); | 2130 allocator_->MarkAsOsrEntry(); |
2130 current_block_->last_environment()->set_ast_id(instr->ast_id()); | 2131 current_block_->last_environment()->set_ast_id(instr->ast_id()); |
2131 return AssignEnvironment(new(zone()) LOsrEntry); | 2132 return AssignEnvironment(new(zone()) LOsrEntry); |
2132 } | 2133 } |
2133 | 2134 |
2134 | 2135 |
2135 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) { | 2136 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) { |
2136 int spill_index = chunk()->GetParameterStackSlot(instr->index()); | 2137 int spill_index = chunk()->GetParameterStackSlot(instr->index()); |
2137 return DefineAsSpilled(new(zone()) LParameter, spill_index); | 2138 return DefineAsSpilled(new(zone()) LParameter, spill_index); |
2138 } | 2139 } |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2258 chunk_->AddInlinedClosure(instr->closure()); | 2259 chunk_->AddInlinedClosure(instr->closure()); |
2259 return NULL; | 2260 return NULL; |
2260 } | 2261 } |
2261 | 2262 |
2262 | 2263 |
2263 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 2264 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
2264 LInstruction* pop = NULL; | 2265 LInstruction* pop = NULL; |
2265 | 2266 |
2266 HEnvironment* env = current_block_->last_environment(); | 2267 HEnvironment* env = current_block_->last_environment(); |
2267 | 2268 |
2268 if (env->entry()->arguments_pushed()) { | 2269 if (instr->arguments_pushed()) { |
2269 int argument_count = env->arguments_environment()->parameter_count(); | 2270 int argument_count = env->arguments_environment()->parameter_count(); |
2270 pop = new(zone()) LDrop(argument_count); | 2271 pop = new(zone()) LDrop(argument_count); |
2271 argument_count_ -= argument_count; | 2272 argument_count_ -= argument_count; |
2272 } | 2273 } |
2273 | 2274 |
2274 HEnvironment* outer = current_block_->last_environment()-> | 2275 HEnvironment* outer = current_block_->last_environment()-> |
2275 DiscardInlined(false); | 2276 DiscardInlined(false); |
2276 current_block_->UpdateEnvironment(outer); | 2277 current_block_->UpdateEnvironment(outer); |
2277 | 2278 |
2278 return pop; | 2279 return pop; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2310 | 2311 |
2311 | 2312 |
2312 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2313 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2313 LOperand* object = UseRegister(instr->object()); | 2314 LOperand* object = UseRegister(instr->object()); |
2314 LOperand* index = UseRegister(instr->index()); | 2315 LOperand* index = UseRegister(instr->index()); |
2315 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2316 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
2316 } | 2317 } |
2317 | 2318 |
2318 | 2319 |
2319 } } // namespace v8::internal | 2320 } } // namespace v8::internal |
OLD | NEW |