OLD | NEW |
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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 // +1 for receiver. | 281 // +1 for receiver. |
282 Forget(arg_count + 1); | 282 Forget(arg_count + 1); |
283 ASSERT(cgen()->HasValidEntryRegisters()); | 283 ASSERT(cgen()->HasValidEntryRegisters()); |
284 ParameterCount count(arg_count); | 284 ParameterCount count(arg_count); |
285 __ InvokeFunction(r1, count, CALL_FUNCTION); | 285 __ InvokeFunction(r1, count, CALL_FUNCTION); |
286 // Restore the context. | 286 // Restore the context. |
287 __ ldr(cp, Context()); | 287 __ ldr(cp, Context()); |
288 } | 288 } |
289 | 289 |
290 | 290 |
291 void VirtualFrame::CallRuntime(Runtime::Function* f, int arg_count) { | 291 void VirtualFrame::CallRuntime(const Runtime::Function* f, int arg_count) { |
292 SpillAll(); | 292 SpillAll(); |
293 Forget(arg_count); | 293 Forget(arg_count); |
294 ASSERT(cgen()->HasValidEntryRegisters()); | 294 ASSERT(cgen()->HasValidEntryRegisters()); |
295 __ CallRuntime(f, arg_count); | 295 __ CallRuntime(f, arg_count); |
296 } | 296 } |
297 | 297 |
298 | 298 |
299 void VirtualFrame::CallRuntime(Runtime::FunctionId id, int arg_count) { | 299 void VirtualFrame::CallRuntime(Runtime::FunctionId id, int arg_count) { |
300 SpillAll(); | 300 SpillAll(); |
301 Forget(arg_count); | 301 Forget(arg_count); |
(...skipping 12 matching lines...) Expand all Loading... |
314 | 314 |
315 void VirtualFrame::InvokeBuiltin(Builtins::JavaScript id, | 315 void VirtualFrame::InvokeBuiltin(Builtins::JavaScript id, |
316 InvokeJSFlags flags, | 316 InvokeJSFlags flags, |
317 int arg_count) { | 317 int arg_count) { |
318 Forget(arg_count); | 318 Forget(arg_count); |
319 __ InvokeBuiltin(id, flags); | 319 __ InvokeBuiltin(id, flags); |
320 } | 320 } |
321 | 321 |
322 | 322 |
323 void VirtualFrame::CallLoadIC(Handle<String> name, RelocInfo::Mode mode) { | 323 void VirtualFrame::CallLoadIC(Handle<String> name, RelocInfo::Mode mode) { |
324 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); | 324 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 325 Builtins::LoadIC_Initialize)); |
325 PopToR0(); | 326 PopToR0(); |
326 SpillAll(); | 327 SpillAll(); |
327 __ mov(r2, Operand(name)); | 328 __ mov(r2, Operand(name)); |
328 CallCodeObject(ic, mode, 0); | 329 CallCodeObject(ic, mode, 0); |
329 } | 330 } |
330 | 331 |
331 | 332 |
332 void VirtualFrame::CallStoreIC(Handle<String> name, | 333 void VirtualFrame::CallStoreIC(Handle<String> name, |
333 bool is_contextual, | 334 bool is_contextual, |
334 StrictModeFlag strict_mode) { | 335 StrictModeFlag strict_mode) { |
335 Handle<Code> ic(Builtins::builtin( | 336 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
336 (strict_mode == kStrictMode) ? Builtins::StoreIC_Initialize_Strict | 337 (strict_mode == kStrictMode) ? Builtins::StoreIC_Initialize_Strict |
337 : Builtins::StoreIC_Initialize)); | 338 : Builtins::StoreIC_Initialize)); |
338 PopToR0(); | 339 PopToR0(); |
339 RelocInfo::Mode mode; | 340 RelocInfo::Mode mode; |
340 if (is_contextual) { | 341 if (is_contextual) { |
341 SpillAll(); | 342 SpillAll(); |
342 __ ldr(r1, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); | 343 __ ldr(r1, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
343 mode = RelocInfo::CODE_TARGET_CONTEXT; | 344 mode = RelocInfo::CODE_TARGET_CONTEXT; |
344 } else { | 345 } else { |
345 EmitPop(r1); | 346 EmitPop(r1); |
346 SpillAll(); | 347 SpillAll(); |
347 mode = RelocInfo::CODE_TARGET; | 348 mode = RelocInfo::CODE_TARGET; |
348 } | 349 } |
349 __ mov(r2, Operand(name)); | 350 __ mov(r2, Operand(name)); |
350 CallCodeObject(ic, mode, 0); | 351 CallCodeObject(ic, mode, 0); |
351 } | 352 } |
352 | 353 |
353 | 354 |
354 void VirtualFrame::CallKeyedLoadIC() { | 355 void VirtualFrame::CallKeyedLoadIC() { |
355 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); | 356 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 357 Builtins::KeyedLoadIC_Initialize)); |
356 PopToR1R0(); | 358 PopToR1R0(); |
357 SpillAll(); | 359 SpillAll(); |
358 CallCodeObject(ic, RelocInfo::CODE_TARGET, 0); | 360 CallCodeObject(ic, RelocInfo::CODE_TARGET, 0); |
359 } | 361 } |
360 | 362 |
361 | 363 |
362 void VirtualFrame::CallKeyedStoreIC(StrictModeFlag strict_mode) { | 364 void VirtualFrame::CallKeyedStoreIC(StrictModeFlag strict_mode) { |
363 Handle<Code> ic(Builtins::builtin( | 365 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
364 (strict_mode == kStrictMode) ? Builtins::KeyedStoreIC_Initialize_Strict | 366 (strict_mode == kStrictMode) ? Builtins::KeyedStoreIC_Initialize_Strict |
365 : Builtins::KeyedStoreIC_Initialize)); | 367 : Builtins::KeyedStoreIC_Initialize)); |
366 PopToR1R0(); | 368 PopToR1R0(); |
367 SpillAll(); | 369 SpillAll(); |
368 EmitPop(r2); | 370 EmitPop(r2); |
369 CallCodeObject(ic, RelocInfo::CODE_TARGET, 0); | 371 CallCodeObject(ic, RelocInfo::CODE_TARGET, 0); |
370 } | 372 } |
371 | 373 |
372 | 374 |
373 void VirtualFrame::CallCodeObject(Handle<Code> code, | 375 void VirtualFrame::CallCodeObject(Handle<Code> code, |
374 RelocInfo::Mode rmode, | 376 RelocInfo::Mode rmode, |
375 int dropped_args) { | 377 int dropped_args) { |
376 switch (code->kind()) { | 378 switch (code->kind()) { |
377 case Code::CALL_IC: | 379 case Code::CALL_IC: |
378 case Code::KEYED_CALL_IC: | 380 case Code::KEYED_CALL_IC: |
379 case Code::FUNCTION: | 381 case Code::FUNCTION: |
380 break; | 382 break; |
381 case Code::KEYED_LOAD_IC: | 383 case Code::KEYED_LOAD_IC: |
382 case Code::LOAD_IC: | 384 case Code::LOAD_IC: |
383 case Code::KEYED_STORE_IC: | 385 case Code::KEYED_STORE_IC: |
384 case Code::STORE_IC: | 386 case Code::STORE_IC: |
385 ASSERT(dropped_args == 0); | 387 ASSERT(dropped_args == 0); |
386 break; | 388 break; |
387 case Code::BUILTIN: | 389 case Code::BUILTIN: |
388 ASSERT(*code == Builtins::builtin(Builtins::JSConstructCall)); | 390 ASSERT(*code == Isolate::Current()->builtins()->builtin( |
| 391 Builtins::JSConstructCall)); |
389 break; | 392 break; |
390 default: | 393 default: |
391 UNREACHABLE(); | 394 UNREACHABLE(); |
392 break; | 395 break; |
393 } | 396 } |
394 Forget(dropped_args); | 397 Forget(dropped_args); |
395 ASSERT(cgen()->HasValidEntryRegisters()); | 398 ASSERT(cgen()->HasValidEntryRegisters()); |
396 __ Call(code, rmode); | 399 __ Call(code, rmode); |
397 } | 400 } |
398 | 401 |
(...skipping 16 matching lines...) Expand all Loading... |
415 // be adjusted. | 418 // be adjusted. |
416 const VirtualFrame::TopOfStack VirtualFrame::kStateAfterPop[TOS_STATES] = | 419 const VirtualFrame::TopOfStack VirtualFrame::kStateAfterPop[TOS_STATES] = |
417 { NO_TOS_REGISTERS, NO_TOS_REGISTERS, NO_TOS_REGISTERS, R0_TOS, R1_TOS }; | 420 { NO_TOS_REGISTERS, NO_TOS_REGISTERS, NO_TOS_REGISTERS, R0_TOS, R1_TOS }; |
418 // Pushing is done by the transition implied by kStateAfterPush. Of course if | 421 // Pushing is done by the transition implied by kStateAfterPush. Of course if |
419 // the maximum number of registers was already allocated to the top of stack | 422 // the maximum number of registers was already allocated to the top of stack |
420 // slots then one register must be physically pushed onto the stack. | 423 // slots then one register must be physically pushed onto the stack. |
421 const VirtualFrame::TopOfStack VirtualFrame::kStateAfterPush[TOS_STATES] = | 424 const VirtualFrame::TopOfStack VirtualFrame::kStateAfterPush[TOS_STATES] = |
422 { R0_TOS, R1_R0_TOS, R0_R1_TOS, R0_R1_TOS, R1_R0_TOS }; | 425 { R0_TOS, R1_R0_TOS, R0_R1_TOS, R0_R1_TOS, R1_R0_TOS }; |
423 | 426 |
424 | 427 |
425 bool VirtualFrame::SpilledScope::is_spilled_ = false; | |
426 | |
427 | |
428 void VirtualFrame::Drop(int count) { | 428 void VirtualFrame::Drop(int count) { |
429 ASSERT(count >= 0); | 429 ASSERT(count >= 0); |
430 ASSERT(height() >= count); | 430 ASSERT(height() >= count); |
431 // Discard elements from the virtual frame and free any registers. | 431 // Discard elements from the virtual frame and free any registers. |
432 int num_virtual_elements = kVirtualElements[top_of_stack_state_]; | 432 int num_virtual_elements = kVirtualElements[top_of_stack_state_]; |
433 while (num_virtual_elements > 0) { | 433 while (num_virtual_elements > 0) { |
434 Pop(); | 434 Pop(); |
435 num_virtual_elements--; | 435 num_virtual_elements--; |
436 count--; | 436 count--; |
437 if (count == 0) return; | 437 if (count == 0) return; |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 break; | 834 break; |
835 } | 835 } |
836 ASSERT(register_allocation_map_ == 0); // Not yet implemented. | 836 ASSERT(register_allocation_map_ == 0); // Not yet implemented. |
837 } | 837 } |
838 | 838 |
839 #undef __ | 839 #undef __ |
840 | 840 |
841 } } // namespace v8::internal | 841 } } // namespace v8::internal |
842 | 842 |
843 #endif // V8_TARGET_ARCH_ARM | 843 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |