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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 } | 189 } |
190 | 190 |
191 | 191 |
192 void LGoto::PrintDataTo(StringStream* stream) { | 192 void LGoto::PrintDataTo(StringStream* stream) { |
193 stream->Add("B%d", block_id()); | 193 stream->Add("B%d", block_id()); |
194 } | 194 } |
195 | 195 |
196 | 196 |
197 void LBranch::PrintDataTo(StringStream* stream) { | 197 void LBranch::PrintDataTo(StringStream* stream) { |
198 stream->Add("B%d | B%d on ", true_block_id(), false_block_id()); | 198 stream->Add("B%d | B%d on ", true_block_id(), false_block_id()); |
199 value()->PrintTo(stream); | 199 InputAt(0)->PrintTo(stream); |
200 } | 200 } |
201 | 201 |
202 | 202 |
203 void LCmpIDAndBranch::PrintDataTo(StringStream* stream) { | 203 void LCmpIDAndBranch::PrintDataTo(StringStream* stream) { |
204 stream->Add("if "); | 204 stream->Add("if "); |
205 left()->PrintTo(stream); | 205 InputAt(0)->PrintTo(stream); |
206 stream->Add(" %s ", Token::String(op())); | 206 stream->Add(" %s ", Token::String(op())); |
207 right()->PrintTo(stream); | 207 InputAt(1)->PrintTo(stream); |
208 stream->Add(" then B%d else B%d", true_block_id(), false_block_id()); | 208 stream->Add(" then B%d else B%d", true_block_id(), false_block_id()); |
209 } | 209 } |
210 | 210 |
211 | 211 |
212 void LIsNilAndBranch::PrintDataTo(StringStream* stream) { | 212 void LIsNilAndBranch::PrintDataTo(StringStream* stream) { |
213 stream->Add("if "); | 213 stream->Add("if "); |
214 value()->PrintTo(stream); | 214 InputAt(0)->PrintTo(stream); |
215 stream->Add(kind() == kStrictEquality ? " === " : " == "); | 215 stream->Add(kind() == kStrictEquality ? " === " : " == "); |
216 stream->Add(nil() == kNullValue ? "null" : "undefined"); | 216 stream->Add(nil() == kNullValue ? "null" : "undefined"); |
217 stream->Add(" then B%d else B%d", true_block_id(), false_block_id()); | 217 stream->Add(" then B%d else B%d", true_block_id(), false_block_id()); |
218 } | 218 } |
219 | 219 |
220 | 220 |
221 void LIsObjectAndBranch::PrintDataTo(StringStream* stream) { | 221 void LIsObjectAndBranch::PrintDataTo(StringStream* stream) { |
222 stream->Add("if is_object("); | 222 stream->Add("if is_object("); |
223 value()->PrintTo(stream); | 223 InputAt(0)->PrintTo(stream); |
224 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); | 224 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); |
225 } | 225 } |
226 | 226 |
227 | 227 |
228 void LIsStringAndBranch::PrintDataTo(StringStream* stream) { | 228 void LIsStringAndBranch::PrintDataTo(StringStream* stream) { |
229 stream->Add("if is_string("); | 229 stream->Add("if is_string("); |
230 value()->PrintTo(stream); | 230 InputAt(0)->PrintTo(stream); |
231 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); | 231 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); |
232 } | 232 } |
233 | 233 |
234 | 234 |
235 void LIsSmiAndBranch::PrintDataTo(StringStream* stream) { | 235 void LIsSmiAndBranch::PrintDataTo(StringStream* stream) { |
236 stream->Add("if is_smi("); | 236 stream->Add("if is_smi("); |
237 value()->PrintTo(stream); | 237 InputAt(0)->PrintTo(stream); |
238 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); | 238 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); |
239 } | 239 } |
240 | 240 |
241 | 241 |
242 void LIsUndetectableAndBranch::PrintDataTo(StringStream* stream) { | 242 void LIsUndetectableAndBranch::PrintDataTo(StringStream* stream) { |
243 stream->Add("if is_undetectable("); | 243 stream->Add("if is_undetectable("); |
244 value()->PrintTo(stream); | 244 InputAt(0)->PrintTo(stream); |
245 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); | 245 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); |
246 } | 246 } |
247 | 247 |
248 | 248 |
249 void LStringCompareAndBranch::PrintDataTo(StringStream* stream) { | 249 void LStringCompareAndBranch::PrintDataTo(StringStream* stream) { |
250 stream->Add("if string_compare("); | 250 stream->Add("if string_compare("); |
251 left()->PrintTo(stream); | 251 InputAt(1)->PrintTo(stream); |
252 right()->PrintTo(stream); | 252 InputAt(2)->PrintTo(stream); |
253 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); | 253 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); |
254 } | 254 } |
255 | 255 |
256 | 256 |
257 void LHasInstanceTypeAndBranch::PrintDataTo(StringStream* stream) { | 257 void LHasInstanceTypeAndBranch::PrintDataTo(StringStream* stream) { |
258 stream->Add("if has_instance_type("); | 258 stream->Add("if has_instance_type("); |
259 value()->PrintTo(stream); | 259 InputAt(0)->PrintTo(stream); |
260 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); | 260 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); |
261 } | 261 } |
262 | 262 |
263 | 263 |
264 void LHasCachedArrayIndexAndBranch::PrintDataTo(StringStream* stream) { | 264 void LHasCachedArrayIndexAndBranch::PrintDataTo(StringStream* stream) { |
265 stream->Add("if has_cached_array_index("); | 265 stream->Add("if has_cached_array_index("); |
266 value()->PrintTo(stream); | 266 InputAt(0)->PrintTo(stream); |
267 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); | 267 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); |
268 } | 268 } |
269 | 269 |
270 | 270 |
271 void LClassOfTestAndBranch::PrintDataTo(StringStream* stream) { | 271 void LClassOfTestAndBranch::PrintDataTo(StringStream* stream) { |
272 stream->Add("if class_of_test("); | 272 stream->Add("if class_of_test("); |
273 value()->PrintTo(stream); | 273 InputAt(0)->PrintTo(stream); |
274 stream->Add(", \"%o\") then B%d else B%d", | 274 stream->Add(", \"%o\") then B%d else B%d", |
275 *hydrogen()->class_name(), | 275 *hydrogen()->class_name(), |
276 true_block_id(), | 276 true_block_id(), |
277 false_block_id()); | 277 false_block_id()); |
278 } | 278 } |
279 | 279 |
280 | 280 |
281 void LTypeofIsAndBranch::PrintDataTo(StringStream* stream) { | 281 void LTypeofIsAndBranch::PrintDataTo(StringStream* stream) { |
282 stream->Add("if typeof "); | 282 stream->Add("if typeof "); |
283 value()->PrintTo(stream); | 283 InputAt(0)->PrintTo(stream); |
284 stream->Add(" == \"%s\" then B%d else B%d", | 284 stream->Add(" == \"%s\" then B%d else B%d", |
285 *hydrogen()->type_literal()->ToCString(), | 285 *hydrogen()->type_literal()->ToCString(), |
286 true_block_id(), false_block_id()); | 286 true_block_id(), false_block_id()); |
287 } | 287 } |
288 | 288 |
289 | 289 |
290 void LCallConstantFunction::PrintDataTo(StringStream* stream) { | 290 void LCallConstantFunction::PrintDataTo(StringStream* stream) { |
291 stream->Add("#%d / ", arity()); | 291 stream->Add("#%d / ", arity()); |
292 } | 292 } |
293 | 293 |
294 | 294 |
295 void LUnaryMathOperation::PrintDataTo(StringStream* stream) { | 295 void LUnaryMathOperation::PrintDataTo(StringStream* stream) { |
296 stream->Add("/%s ", hydrogen()->OpName()); | 296 stream->Add("/%s ", hydrogen()->OpName()); |
297 value()->PrintTo(stream); | 297 InputAt(0)->PrintTo(stream); |
298 } | 298 } |
299 | 299 |
300 | 300 |
301 void LMathPowHalf::PrintDataTo(StringStream* stream) { | 301 void LMathPowHalf::PrintDataTo(StringStream* stream) { |
302 stream->Add("/pow_half "); | 302 stream->Add("/pow_half "); |
303 value()->PrintTo(stream); | 303 InputAt(0)->PrintTo(stream); |
304 } | 304 } |
305 | 305 |
306 | 306 |
307 void LLoadContextSlot::PrintDataTo(StringStream* stream) { | 307 void LLoadContextSlot::PrintDataTo(StringStream* stream) { |
308 context()->PrintTo(stream); | 308 InputAt(0)->PrintTo(stream); |
309 stream->Add("[%d]", slot_index()); | 309 stream->Add("[%d]", slot_index()); |
310 } | 310 } |
311 | 311 |
312 | 312 |
313 void LStoreContextSlot::PrintDataTo(StringStream* stream) { | 313 void LStoreContextSlot::PrintDataTo(StringStream* stream) { |
314 context()->PrintTo(stream); | 314 InputAt(0)->PrintTo(stream); |
315 stream->Add("[%d] <- ", slot_index()); | 315 stream->Add("[%d] <- ", slot_index()); |
316 value()->PrintTo(stream); | 316 InputAt(1)->PrintTo(stream); |
317 } | 317 } |
318 | 318 |
319 | 319 |
320 void LInvokeFunction::PrintDataTo(StringStream* stream) { | 320 void LInvokeFunction::PrintDataTo(StringStream* stream) { |
321 stream->Add("= "); | 321 stream->Add("= "); |
322 context()->PrintTo(stream); | 322 InputAt(0)->PrintTo(stream); |
323 stream->Add(" "); | 323 stream->Add(" "); |
324 function()->PrintTo(stream); | 324 InputAt(1)->PrintTo(stream); |
325 stream->Add(" #%d / ", arity()); | 325 stream->Add(" #%d / ", arity()); |
326 } | 326 } |
327 | 327 |
328 | 328 |
329 void LCallKeyed::PrintDataTo(StringStream* stream) { | 329 void LCallKeyed::PrintDataTo(StringStream* stream) { |
330 stream->Add("[ecx] #%d / ", arity()); | 330 stream->Add("[ecx] #%d / ", arity()); |
331 } | 331 } |
332 | 332 |
333 | 333 |
334 void LCallNamed::PrintDataTo(StringStream* stream) { | 334 void LCallNamed::PrintDataTo(StringStream* stream) { |
335 SmartArrayPointer<char> name_string = name()->ToCString(); | 335 SmartArrayPointer<char> name_string = name()->ToCString(); |
336 stream->Add("%s #%d / ", *name_string, arity()); | 336 stream->Add("%s #%d / ", *name_string, arity()); |
337 } | 337 } |
338 | 338 |
339 | 339 |
340 void LCallGlobal::PrintDataTo(StringStream* stream) { | 340 void LCallGlobal::PrintDataTo(StringStream* stream) { |
341 SmartArrayPointer<char> name_string = name()->ToCString(); | 341 SmartArrayPointer<char> name_string = name()->ToCString(); |
342 stream->Add("%s #%d / ", *name_string, arity()); | 342 stream->Add("%s #%d / ", *name_string, arity()); |
343 } | 343 } |
344 | 344 |
345 | 345 |
346 void LCallKnownGlobal::PrintDataTo(StringStream* stream) { | 346 void LCallKnownGlobal::PrintDataTo(StringStream* stream) { |
347 stream->Add("#%d / ", arity()); | 347 stream->Add("#%d / ", arity()); |
348 } | 348 } |
349 | 349 |
350 | 350 |
351 void LCallNew::PrintDataTo(StringStream* stream) { | 351 void LCallNew::PrintDataTo(StringStream* stream) { |
352 stream->Add("= "); | 352 stream->Add("= "); |
353 context()->PrintTo(stream); | 353 InputAt(0)->PrintTo(stream); |
354 stream->Add(" "); | |
355 constructor()->PrintTo(stream); | |
356 stream->Add(" #%d / ", arity()); | 354 stream->Add(" #%d / ", arity()); |
357 } | 355 } |
358 | 356 |
359 | 357 |
360 void LAccessArgumentsAt::PrintDataTo(StringStream* stream) { | 358 void LAccessArgumentsAt::PrintDataTo(StringStream* stream) { |
361 arguments()->PrintTo(stream); | 359 arguments()->PrintTo(stream); |
362 | 360 |
363 stream->Add(" length "); | 361 stream->Add(" length "); |
364 length()->PrintTo(stream); | 362 length()->PrintTo(stream); |
365 | 363 |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 hydrogen_env->frame_type() != JS_FUNCTION); | 879 hydrogen_env->frame_type() != JS_FUNCTION); |
882 int value_count = hydrogen_env->length(); | 880 int value_count = hydrogen_env->length(); |
883 LEnvironment* result = | 881 LEnvironment* result = |
884 new(zone()) LEnvironment(hydrogen_env->closure(), | 882 new(zone()) LEnvironment(hydrogen_env->closure(), |
885 hydrogen_env->frame_type(), | 883 hydrogen_env->frame_type(), |
886 ast_id, | 884 ast_id, |
887 hydrogen_env->parameter_count(), | 885 hydrogen_env->parameter_count(), |
888 argument_count_, | 886 argument_count_, |
889 value_count, | 887 value_count, |
890 outer, | 888 outer, |
891 hydrogen_env->entry(), | |
892 zone()); | 889 zone()); |
893 int argument_index = *argument_index_accumulator; | 890 int argument_index = *argument_index_accumulator; |
894 for (int i = 0; i < value_count; ++i) { | 891 for (int i = 0; i < value_count; ++i) { |
895 if (hydrogen_env->is_special_index(i)) continue; | 892 if (hydrogen_env->is_special_index(i)) continue; |
896 | 893 |
897 HValue* value = hydrogen_env->values()->at(i); | 894 HValue* value = hydrogen_env->values()->at(i); |
898 LOperand* op = NULL; | 895 LOperand* op = NULL; |
899 if (value->IsArgumentsObject()) { | 896 if (value->IsArgumentsObject()) { |
900 op = NULL; | 897 op = NULL; |
901 } else if (value->IsPushArgument()) { | 898 } else if (value->IsPushArgument()) { |
(...skipping 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2231 LInstruction* LChunkBuilder::DoDeleteProperty(HDeleteProperty* instr) { | 2228 LInstruction* LChunkBuilder::DoDeleteProperty(HDeleteProperty* instr) { |
2232 LOperand* context = UseFixed(instr->context(), esi); | 2229 LOperand* context = UseFixed(instr->context(), esi); |
2233 LOperand* object = UseAtStart(instr->object()); | 2230 LOperand* object = UseAtStart(instr->object()); |
2234 LOperand* key = UseOrConstantAtStart(instr->key()); | 2231 LOperand* key = UseOrConstantAtStart(instr->key()); |
2235 LDeleteProperty* result = new(zone()) LDeleteProperty(context, object, key); | 2232 LDeleteProperty* result = new(zone()) LDeleteProperty(context, object, key); |
2236 return MarkAsCall(DefineFixed(result, eax), instr); | 2233 return MarkAsCall(DefineFixed(result, eax), instr); |
2237 } | 2234 } |
2238 | 2235 |
2239 | 2236 |
2240 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { | 2237 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { |
2241 ASSERT(argument_count_ == 0); | |
2242 allocator_->MarkAsOsrEntry(); | 2238 allocator_->MarkAsOsrEntry(); |
2243 current_block_->last_environment()->set_ast_id(instr->ast_id()); | 2239 current_block_->last_environment()->set_ast_id(instr->ast_id()); |
2244 return AssignEnvironment(new(zone()) LOsrEntry); | 2240 return AssignEnvironment(new(zone()) LOsrEntry); |
2245 } | 2241 } |
2246 | 2242 |
2247 | 2243 |
2248 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) { | 2244 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) { |
2249 int spill_index = chunk()->GetParameterStackSlot(instr->index()); | 2245 int spill_index = chunk()->GetParameterStackSlot(instr->index()); |
2250 return DefineAsSpilled(new(zone()) LParameter, spill_index); | 2246 return DefineAsSpilled(new(zone()) LParameter, spill_index); |
2251 } | 2247 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2367 HConstant* undefined = graph()->GetConstantUndefined(); | 2363 HConstant* undefined = graph()->GetConstantUndefined(); |
2368 HEnvironment* inner = outer->CopyForInlining(instr->closure(), | 2364 HEnvironment* inner = outer->CopyForInlining(instr->closure(), |
2369 instr->arguments_count(), | 2365 instr->arguments_count(), |
2370 instr->function(), | 2366 instr->function(), |
2371 undefined, | 2367 undefined, |
2372 instr->call_kind(), | 2368 instr->call_kind(), |
2373 instr->inlining_kind()); | 2369 instr->inlining_kind()); |
2374 if (instr->arguments_var() != NULL) { | 2370 if (instr->arguments_var() != NULL) { |
2375 inner->Bind(instr->arguments_var(), graph()->GetArgumentsObject()); | 2371 inner->Bind(instr->arguments_var(), graph()->GetArgumentsObject()); |
2376 } | 2372 } |
2377 inner->set_entry(instr); | |
2378 current_block_->UpdateEnvironment(inner); | 2373 current_block_->UpdateEnvironment(inner); |
2379 chunk_->AddInlinedClosure(instr->closure()); | 2374 chunk_->AddInlinedClosure(instr->closure()); |
2380 return NULL; | 2375 return NULL; |
2381 } | 2376 } |
2382 | 2377 |
2383 | 2378 |
2384 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 2379 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
2385 LInstruction* pop = NULL; | 2380 LInstruction* pop = NULL; |
2386 | 2381 |
2387 HEnvironment* env = current_block_->last_environment(); | 2382 HEnvironment* env = current_block_->last_environment(); |
2388 | 2383 |
2389 if (env->entry()->arguments_pushed()) { | 2384 if (instr->arguments_pushed()) { |
2390 int argument_count = env->arguments_environment()->parameter_count(); | 2385 int argument_count = env->arguments_environment()->parameter_count(); |
2391 pop = new(zone()) LDrop(argument_count); | 2386 pop = new(zone()) LDrop(argument_count); |
2392 argument_count_ -= argument_count; | 2387 argument_count_ -= argument_count; |
2393 } | 2388 } |
2394 | 2389 |
2395 HEnvironment* outer = current_block_->last_environment()-> | 2390 HEnvironment* outer = current_block_->last_environment()-> |
2396 DiscardInlined(false); | 2391 DiscardInlined(false); |
2397 current_block_->UpdateEnvironment(outer); | 2392 current_block_->UpdateEnvironment(outer); |
2398 return pop; | 2393 return pop; |
2399 } | 2394 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2433 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2428 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2434 LOperand* object = UseRegister(instr->object()); | 2429 LOperand* object = UseRegister(instr->object()); |
2435 LOperand* index = UseTempRegister(instr->index()); | 2430 LOperand* index = UseTempRegister(instr->index()); |
2436 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2431 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2437 } | 2432 } |
2438 | 2433 |
2439 | 2434 |
2440 } } // namespace v8::internal | 2435 } } // namespace v8::internal |
2441 | 2436 |
2442 #endif // V8_TARGET_ARCH_IA32 | 2437 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |