| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 | 225 |
| 226 // Patch the function on the stack; 1 ~ receiver. | 226 // Patch the function on the stack; 1 ~ receiver. |
| 227 __ str(r1, MemOperand(sp, (argc + 1) * kPointerSize)); | 227 __ str(r1, MemOperand(sp, (argc + 1) * kPointerSize)); |
| 228 | 228 |
| 229 // Invoke the function. | 229 // Invoke the function. |
| 230 __ InvokeFunction(r1, arguments(), JUMP_FUNCTION); | 230 __ InvokeFunction(r1, arguments(), JUMP_FUNCTION); |
| 231 | 231 |
| 232 // Handle call cache miss. | 232 // Handle call cache miss. |
| 233 __ bind(&miss); | 233 __ bind(&miss); |
| 234 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); | 234 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); |
| 235 __ Jump(ic, code_target); | 235 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 236 | 236 |
| 237 // Return the generated code. | 237 // Return the generated code. |
| 238 return GetCode(FIELD); | 238 return GetCode(FIELD); |
| 239 } | 239 } |
| 240 | 240 |
| 241 | 241 |
| 242 Object* CallStubCompiler::CompileCallConstant(Object* object, | 242 Object* CallStubCompiler::CompileCallConstant(Object* object, |
| 243 JSObject* holder, | 243 JSObject* holder, |
| 244 JSFunction* function, | 244 JSFunction* function, |
| 245 CheckType check) { | 245 CheckType check) { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 // Get the function and setup the context. | 334 // Get the function and setup the context. |
| 335 __ mov(r1, Operand(Handle<JSFunction>(function))); | 335 __ mov(r1, Operand(Handle<JSFunction>(function))); |
| 336 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 336 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
| 337 | 337 |
| 338 // Patch the function on the stack; 1 ~ receiver. | 338 // Patch the function on the stack; 1 ~ receiver. |
| 339 __ str(r1, MemOperand(sp, (argc + 1) * kPointerSize)); | 339 __ str(r1, MemOperand(sp, (argc + 1) * kPointerSize)); |
| 340 | 340 |
| 341 // Jump to the cached code (tail call). | 341 // Jump to the cached code (tail call). |
| 342 Handle<Code> code(function->code()); | 342 Handle<Code> code(function->code()); |
| 343 ParameterCount expected(function->shared()->formal_parameter_count()); | 343 ParameterCount expected(function->shared()->formal_parameter_count()); |
| 344 __ InvokeCode(code, expected, arguments(), code_target, JUMP_FUNCTION); | 344 __ InvokeCode(code, expected, arguments(), |
| 345 RelocInfo::CODE_TARGET, JUMP_FUNCTION); |
| 345 | 346 |
| 346 // Handle call cache miss. | 347 // Handle call cache miss. |
| 347 __ bind(&miss); | 348 __ bind(&miss); |
| 348 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); | 349 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); |
| 349 __ Jump(ic, code_target); | 350 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 350 | 351 |
| 351 // Return the generated code. | 352 // Return the generated code. |
| 352 return GetCode(CONSTANT_FUNCTION); | 353 return GetCode(CONSTANT_FUNCTION); |
| 353 } | 354 } |
| 354 | 355 |
| 355 | 356 |
| 356 Object* CallStubCompiler::CompileCallInterceptor(Object* object, | 357 Object* CallStubCompiler::CompileCallInterceptor(Object* object, |
| 357 JSObject* holder, | 358 JSObject* holder, |
| 358 String* name) { | 359 String* name) { |
| 359 // ----------- S t a t e ------------- | 360 // ----------- S t a t e ------------- |
| 360 // -- lr: return address | 361 // -- lr: return address |
| 361 // ----------------------------------- | 362 // ----------------------------------- |
| 362 | 363 |
| 363 HandleScope scope; | 364 HandleScope scope; |
| 364 Label miss; | 365 Label miss; |
| 365 | 366 |
| 366 // TODO(1224669): Implement. | 367 // TODO(1224669): Implement. |
| 367 | 368 |
| 368 // Handle call cache miss. | 369 // Handle call cache miss. |
| 369 __ bind(&miss); | 370 __ bind(&miss); |
| 370 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); | 371 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); |
| 371 __ Jump(ic, code_target); | 372 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 372 | 373 |
| 373 // Return the generated code. | 374 // Return the generated code. |
| 374 return GetCode(INTERCEPTOR); | 375 return GetCode(INTERCEPTOR); |
| 375 } | 376 } |
| 376 | 377 |
| 377 | 378 |
| 378 Object* StoreStubCompiler::CompileStoreField(JSObject* object, | 379 Object* StoreStubCompiler::CompileStoreField(JSObject* object, |
| 379 int index, | 380 int index, |
| 380 Map* transition, | 381 Map* transition, |
| 381 String* name) { | 382 String* name) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 __ RecordWrite(r1, r3, r2); // OK to clobber r2, since we return | 435 __ RecordWrite(r1, r3, r2); // OK to clobber r2, since we return |
| 435 | 436 |
| 436 // Return the value (register r0). | 437 // Return the value (register r0). |
| 437 __ bind(&exit); | 438 __ bind(&exit); |
| 438 __ Ret(); | 439 __ Ret(); |
| 439 | 440 |
| 440 // Handle store cache miss. | 441 // Handle store cache miss. |
| 441 __ bind(&miss); | 442 __ bind(&miss); |
| 442 __ mov(r2, Operand(Handle<String>(name))); // restore name | 443 __ mov(r2, Operand(Handle<String>(name))); // restore name |
| 443 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); | 444 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); |
| 444 __ Jump(ic, code_target); | 445 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 445 | 446 |
| 446 // Return the generated code. | 447 // Return the generated code. |
| 447 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION); | 448 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION); |
| 448 } | 449 } |
| 449 | 450 |
| 450 | 451 |
| 451 Object* StoreStubCompiler::CompileStoreCallback(JSObject* object, | 452 Object* StoreStubCompiler::CompileStoreCallback(JSObject* object, |
| 452 AccessorInfo* callback, | 453 AccessorInfo* callback, |
| 453 String* name) { | 454 String* name) { |
| 454 // ----------- S t a t e ------------- | 455 // ----------- S t a t e ------------- |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 | 492 |
| 492 // Do tail-call to the runtime system. | 493 // Do tail-call to the runtime system. |
| 493 ExternalReference store_callback_property = | 494 ExternalReference store_callback_property = |
| 494 ExternalReference(IC_Utility(IC::kStoreCallbackProperty)); | 495 ExternalReference(IC_Utility(IC::kStoreCallbackProperty)); |
| 495 __ TailCallRuntime(store_callback_property, 4); | 496 __ TailCallRuntime(store_callback_property, 4); |
| 496 | 497 |
| 497 // Handle store cache miss. | 498 // Handle store cache miss. |
| 498 __ bind(&miss); | 499 __ bind(&miss); |
| 499 __ mov(r2, Operand(Handle<String>(name))); // restore name | 500 __ mov(r2, Operand(Handle<String>(name))); // restore name |
| 500 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); | 501 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); |
| 501 __ Jump(ic, code_target); | 502 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 502 | 503 |
| 503 // Return the generated code. | 504 // Return the generated code. |
| 504 return GetCode(CALLBACKS); | 505 return GetCode(CALLBACKS); |
| 505 } | 506 } |
| 506 | 507 |
| 507 | 508 |
| 508 Object* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver, | 509 Object* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver, |
| 509 String* name) { | 510 String* name) { |
| 510 // ----------- S t a t e ------------- | 511 // ----------- S t a t e ------------- |
| 511 // -- r0 : value | 512 // -- r0 : value |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 | 546 |
| 546 // Do tail-call to the runtime system. | 547 // Do tail-call to the runtime system. |
| 547 ExternalReference store_ic_property = | 548 ExternalReference store_ic_property = |
| 548 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty)); | 549 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty)); |
| 549 __ TailCallRuntime(store_ic_property, 3); | 550 __ TailCallRuntime(store_ic_property, 3); |
| 550 | 551 |
| 551 // Handle store cache miss. | 552 // Handle store cache miss. |
| 552 __ bind(&miss); | 553 __ bind(&miss); |
| 553 __ mov(r2, Operand(Handle<String>(name))); // restore name | 554 __ mov(r2, Operand(Handle<String>(name))); // restore name |
| 554 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); | 555 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); |
| 555 __ Jump(ic, code_target); | 556 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 556 | 557 |
| 557 // Return the generated code. | 558 // Return the generated code. |
| 558 return GetCode(INTERCEPTOR); | 559 return GetCode(INTERCEPTOR); |
| 559 } | 560 } |
| 560 | 561 |
| 561 | 562 |
| 562 Object* LoadStubCompiler::CompileLoadField(JSObject* object, | 563 Object* LoadStubCompiler::CompileLoadField(JSObject* object, |
| 563 JSObject* holder, | 564 JSObject* holder, |
| 564 int index) { | 565 int index) { |
| 565 // ----------- S t a t e ------------- | 566 // ----------- S t a t e ------------- |
| (...skipping 19 matching lines...) Expand all Loading... |
| 585 | 586 |
| 586 // Return the value from the properties array. | 587 // Return the value from the properties array. |
| 587 int offset = index * kPointerSize + Array::kHeaderSize; | 588 int offset = index * kPointerSize + Array::kHeaderSize; |
| 588 __ ldr(r0, FieldMemOperand(r3, offset)); | 589 __ ldr(r0, FieldMemOperand(r3, offset)); |
| 589 __ Ret(); | 590 __ Ret(); |
| 590 | 591 |
| 591 // Handle load cache miss. | 592 // Handle load cache miss. |
| 592 __ bind(&miss); | 593 __ bind(&miss); |
| 593 __ ldr(r0, MemOperand(sp)); // restore receiver | 594 __ ldr(r0, MemOperand(sp)); // restore receiver |
| 594 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Miss)); | 595 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Miss)); |
| 595 __ Jump(ic, code_target); | 596 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 596 | 597 |
| 597 // Return the generated code. | 598 // Return the generated code. |
| 598 return GetCode(FIELD); | 599 return GetCode(FIELD); |
| 599 } | 600 } |
| 600 | 601 |
| 601 | 602 |
| 602 Object* LoadStubCompiler::CompileLoadCallback(JSObject* object, | 603 Object* LoadStubCompiler::CompileLoadCallback(JSObject* object, |
| 603 JSObject* holder, | 604 JSObject* holder, |
| 604 AccessorInfo* callback) { | 605 AccessorInfo* callback) { |
| 605 // ----------- S t a t e ------------- | 606 // ----------- S t a t e ------------- |
| (...skipping 21 matching lines...) Expand all Loading... |
| 627 __ push(reg); // holder | 628 __ push(reg); // holder |
| 628 | 629 |
| 629 // Do tail-call to the runtime system. | 630 // Do tail-call to the runtime system. |
| 630 ExternalReference load_callback_property = | 631 ExternalReference load_callback_property = |
| 631 ExternalReference(IC_Utility(IC::kLoadCallbackProperty)); | 632 ExternalReference(IC_Utility(IC::kLoadCallbackProperty)); |
| 632 __ TailCallRuntime(load_callback_property, 4); | 633 __ TailCallRuntime(load_callback_property, 4); |
| 633 | 634 |
| 634 // Handle load cache miss. | 635 // Handle load cache miss. |
| 635 __ bind(&miss); | 636 __ bind(&miss); |
| 636 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Miss)); | 637 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Miss)); |
| 637 __ Jump(ic, code_target); | 638 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 638 | 639 |
| 639 // Return the generated code. | 640 // Return the generated code. |
| 640 return GetCode(CALLBACKS); | 641 return GetCode(CALLBACKS); |
| 641 } | 642 } |
| 642 | 643 |
| 643 | 644 |
| 644 Object* LoadStubCompiler::CompileLoadConstant(JSObject* object, | 645 Object* LoadStubCompiler::CompileLoadConstant(JSObject* object, |
| 645 JSObject* holder, | 646 JSObject* holder, |
| 646 Object* value) { | 647 Object* value) { |
| 647 // ----------- S t a t e ------------- | 648 // ----------- S t a t e ------------- |
| (...skipping 13 matching lines...) Expand all Loading... |
| 661 // Check that the maps haven't changed. | 662 // Check that the maps haven't changed. |
| 662 Register reg = __ CheckMaps(object, r0, holder, r3, r1, &miss); | 663 Register reg = __ CheckMaps(object, r0, holder, r3, r1, &miss); |
| 663 | 664 |
| 664 // Return the constant value. | 665 // Return the constant value. |
| 665 __ mov(r0, Operand(Handle<Object>(value))); | 666 __ mov(r0, Operand(Handle<Object>(value))); |
| 666 __ Ret(); | 667 __ Ret(); |
| 667 | 668 |
| 668 // Handle load cache miss. | 669 // Handle load cache miss. |
| 669 __ bind(&miss); | 670 __ bind(&miss); |
| 670 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Miss)); | 671 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Miss)); |
| 671 __ Jump(ic, code_target); | 672 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 672 | 673 |
| 673 // Return the generated code. | 674 // Return the generated code. |
| 674 return GetCode(CONSTANT_FUNCTION); | 675 return GetCode(CONSTANT_FUNCTION); |
| 675 } | 676 } |
| 676 | 677 |
| 677 | 678 |
| 678 Object* LoadStubCompiler::CompileLoadInterceptor(JSObject* object, | 679 Object* LoadStubCompiler::CompileLoadInterceptor(JSObject* object, |
| 679 JSObject* holder, | 680 JSObject* holder, |
| 680 String* name) { | 681 String* name) { |
| 681 // ----------- S t a t e ------------- | 682 // ----------- S t a t e ------------- |
| (...skipping 19 matching lines...) Expand all Loading... |
| 701 __ push(r2); // name | 702 __ push(r2); // name |
| 702 | 703 |
| 703 // Do tail-call to the runtime system. | 704 // Do tail-call to the runtime system. |
| 704 ExternalReference load_ic_property = | 705 ExternalReference load_ic_property = |
| 705 ExternalReference(IC_Utility(IC::kLoadInterceptorProperty)); | 706 ExternalReference(IC_Utility(IC::kLoadInterceptorProperty)); |
| 706 __ TailCallRuntime(load_ic_property, 3); | 707 __ TailCallRuntime(load_ic_property, 3); |
| 707 | 708 |
| 708 // Handle load cache miss. | 709 // Handle load cache miss. |
| 709 __ bind(&miss); | 710 __ bind(&miss); |
| 710 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Miss)); | 711 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Miss)); |
| 711 __ Jump(ic, code_target); | 712 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 712 | 713 |
| 713 // Return the generated code. | 714 // Return the generated code. |
| 714 return GetCode(INTERCEPTOR); | 715 return GetCode(INTERCEPTOR); |
| 715 } | 716 } |
| 716 | 717 |
| 717 | 718 |
| 718 // TODO(1224671): IC stubs for keyed loads have not been implemented | 719 // TODO(1224671): IC stubs for keyed loads have not been implemented |
| 719 // for ARM. | 720 // for ARM. |
| 720 Object* KeyedLoadStubCompiler::CompileLoadField(String* name, | 721 Object* KeyedLoadStubCompiler::CompileLoadField(String* name, |
| 721 JSObject* receiver, | 722 JSObject* receiver, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 String* name) { | 789 String* name) { |
| 789 UNIMPLEMENTED(); | 790 UNIMPLEMENTED(); |
| 790 return Heap::undefined_value(); | 791 return Heap::undefined_value(); |
| 791 } | 792 } |
| 792 | 793 |
| 793 | 794 |
| 794 | 795 |
| 795 #undef __ | 796 #undef __ |
| 796 | 797 |
| 797 } } // namespace v8::internal | 798 } } // namespace v8::internal |
| OLD | NEW |