| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 ASSERT(ToRegister(instr->constructor()).is(x1)); | 467 ASSERT(ToRegister(instr->constructor()).is(x1)); |
| 468 | 468 |
| 469 __ Mov(x0, Operand(instr->arity())); | 469 __ Mov(x0, Operand(instr->arity())); |
| 470 __ Mov(x2, Operand(instr->hydrogen()->property_cell())); | 470 __ Mov(x2, Operand(instr->hydrogen()->property_cell())); |
| 471 | 471 |
| 472 ElementsKind kind = instr->hydrogen()->elements_kind(); | 472 ElementsKind kind = instr->hydrogen()->elements_kind(); |
| 473 AllocationSiteOverrideMode override_mode = | 473 AllocationSiteOverrideMode override_mode = |
| 474 (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE) | 474 (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE) |
| 475 ? DISABLE_ALLOCATION_SITES | 475 ? DISABLE_ALLOCATION_SITES |
| 476 : DONT_OVERRIDE; | 476 : DONT_OVERRIDE; |
| 477 ContextCheckMode context_mode = CONTEXT_CHECK_NOT_REQUIRED; | |
| 478 | 477 |
| 479 if (instr->arity() == 0) { | 478 if (instr->arity() == 0) { |
| 480 ArrayNoArgumentConstructorStub stub(kind, context_mode, override_mode); | 479 ArrayNoArgumentConstructorStub stub(kind, override_mode); |
| 481 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); | 480 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 482 } else if (instr->arity() == 1) { | 481 } else if (instr->arity() == 1) { |
| 483 Label done; | 482 Label done; |
| 484 if (IsFastPackedElementsKind(kind)) { | 483 if (IsFastPackedElementsKind(kind)) { |
| 485 Label packed_case; | 484 Label packed_case; |
| 486 | 485 |
| 487 // We might need to create a holey array; look at the first argument. | 486 // We might need to create a holey array; look at the first argument. |
| 488 __ Peek(x10, 0); | 487 __ Peek(x10, 0); |
| 489 __ Cbz(x10, &packed_case); | 488 __ Cbz(x10, &packed_case); |
| 490 | 489 |
| 491 ElementsKind holey_kind = GetHoleyElementsKind(kind); | 490 ElementsKind holey_kind = GetHoleyElementsKind(kind); |
| 492 ArraySingleArgumentConstructorStub stub(holey_kind, context_mode, | 491 ArraySingleArgumentConstructorStub stub(holey_kind, override_mode); |
| 493 override_mode); | |
| 494 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); | 492 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 495 __ B(&done); | 493 __ B(&done); |
| 496 __ Bind(&packed_case); | 494 __ Bind(&packed_case); |
| 497 } | 495 } |
| 498 | 496 |
| 499 ArraySingleArgumentConstructorStub stub(kind, context_mode, override_mode); | 497 ArraySingleArgumentConstructorStub stub(kind, override_mode); |
| 500 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); | 498 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 501 __ Bind(&done); | 499 __ Bind(&done); |
| 502 } else { | 500 } else { |
| 503 ArrayNArgumentsConstructorStub stub(kind, context_mode, override_mode); | 501 ArrayNArgumentsConstructorStub stub(kind, override_mode); |
| 504 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); | 502 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 505 } | 503 } |
| 506 | 504 |
| 507 ASSERT(ToRegister(instr->result()).is(x0)); | 505 ASSERT(ToRegister(instr->result()).is(x0)); |
| 508 } | 506 } |
| 509 | 507 |
| 510 | 508 |
| 511 void LCodeGen::CallRuntime(const Runtime::Function* function, | 509 void LCodeGen::CallRuntime(const Runtime::Function* function, |
| 512 int num_arguments, | 510 int num_arguments, |
| 513 LInstruction* instr, | 511 LInstruction* instr, |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 | 652 |
| 655 | 653 |
| 656 bool LCodeGen::GeneratePrologue() { | 654 bool LCodeGen::GeneratePrologue() { |
| 657 ASSERT(is_generating()); | 655 ASSERT(is_generating()); |
| 658 | 656 |
| 659 if (info()->IsOptimizing()) { | 657 if (info()->IsOptimizing()) { |
| 660 ProfileEntryHookStub::MaybeCallEntryHook(masm_); | 658 ProfileEntryHookStub::MaybeCallEntryHook(masm_); |
| 661 | 659 |
| 662 // TODO(all): Add support for stop_t FLAG in DEBUG mode. | 660 // TODO(all): Add support for stop_t FLAG in DEBUG mode. |
| 663 | 661 |
| 664 // Strict mode functions and builtins need to replace the receiver | 662 // Classic mode functions and builtins need to replace the receiver with the |
| 665 // with undefined when called as functions (without an explicit | 663 // global proxy when called as functions (without an explicit receiver |
| 666 // receiver object). | 664 // object). |
| 667 // x5 holds the call kind and is zero for method calls and non-zero for | 665 if (info_->this_has_uses() && |
| 668 // function calls. | 666 info_->is_classic_mode() && |
| 669 if (!info_->is_classic_mode() || info_->is_native()) { | 667 !info_->is_native()) { |
| 670 Label ok; | 668 Label ok; |
| 671 __ Cbz(x5, &ok); | 669 __ Cbz(x5, &ok); |
| 672 int receiver_offset = scope()->num_parameters() * kPointerSize; | 670 int receiver_offset = info_->scope()->num_parameters() * kXRegSizeInBytes; |
| 673 __ LoadRoot(x10, Heap::kUndefinedValueRootIndex); | 671 __ Peek(x10, receiver_offset); |
| 672 __ JumpIfNotRoot(x10, Heap::kUndefinedValueRootIndex, &ok); |
| 673 |
| 674 __ Ldr(x10, GlobalObjectMemOperand()); |
| 675 __ Ldr(x10, FieldMemOperand(x10, GlobalObject::kGlobalReceiverOffset)); |
| 674 __ Poke(x10, receiver_offset); | 676 __ Poke(x10, receiver_offset); |
| 677 |
| 675 __ Bind(&ok); | 678 __ Bind(&ok); |
| 676 } | 679 } |
| 677 } | 680 } |
| 678 | 681 |
| 679 ASSERT(__ StackPointer().Is(jssp)); | 682 ASSERT(__ StackPointer().Is(jssp)); |
| 680 info()->set_prologue_offset(masm_->pc_offset()); | 683 info()->set_prologue_offset(masm_->pc_offset()); |
| 681 if (NeedsEagerFrame()) { | 684 if (NeedsEagerFrame()) { |
| 682 __ Prologue(info()->IsStub() ? BUILD_STUB_FRAME : BUILD_FUNCTION_FRAME); | 685 __ Prologue(info()->IsStub() ? BUILD_STUB_FRAME : BUILD_FUNCTION_FRAME); |
| 683 frame_is_built_ = true; | 686 frame_is_built_ = true; |
| 684 info_->AddNoFrameRange(0, masm_->pc_offset()); | 687 info_->AddNoFrameRange(0, masm_->pc_offset()); |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1538 __ B(ne, &loop); | 1541 __ B(ne, &loop); |
| 1539 | 1542 |
| 1540 __ Bind(&invoke); | 1543 __ Bind(&invoke); |
| 1541 ASSERT(instr->HasPointerMap()); | 1544 ASSERT(instr->HasPointerMap()); |
| 1542 LPointerMap* pointers = instr->pointer_map(); | 1545 LPointerMap* pointers = instr->pointer_map(); |
| 1543 SafepointGenerator safepoint_generator(this, pointers, Safepoint::kLazyDeopt); | 1546 SafepointGenerator safepoint_generator(this, pointers, Safepoint::kLazyDeopt); |
| 1544 // The number of arguments is stored in argc (receiver) which is x0, as | 1547 // The number of arguments is stored in argc (receiver) which is x0, as |
| 1545 // expected by InvokeFunction. | 1548 // expected by InvokeFunction. |
| 1546 ParameterCount actual(argc); | 1549 ParameterCount actual(argc); |
| 1547 __ InvokeFunction(function, actual, CALL_FUNCTION, | 1550 __ InvokeFunction(function, actual, CALL_FUNCTION, |
| 1548 safepoint_generator, CALL_AS_METHOD); | 1551 safepoint_generator, CALL_AS_FUNCTION); |
| 1549 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 1552 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 1550 } | 1553 } |
| 1551 | 1554 |
| 1552 | 1555 |
| 1553 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { | 1556 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { |
| 1554 Register result = ToRegister(instr->result()); | 1557 Register result = ToRegister(instr->result()); |
| 1555 | 1558 |
| 1556 if (instr->hydrogen()->from_inlined()) { | 1559 if (instr->hydrogen()->from_inlined()) { |
| 1557 // When we are inside an inlined function, the arguments are the last things | 1560 // When we are inside an inlined function, the arguments are the last things |
| 1558 // that have been pushed on the stack. Therefore the arguments array can be | 1561 // that have been pushed on the stack. Therefore the arguments array can be |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1908 | 1911 |
| 1909 // Restore context. | 1912 // Restore context. |
| 1910 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 1913 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 1911 } | 1914 } |
| 1912 | 1915 |
| 1913 | 1916 |
| 1914 void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) { | 1917 void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) { |
| 1915 ASSERT(ToRegister(instr->result()).is(x0)); | 1918 ASSERT(ToRegister(instr->result()).is(x0)); |
| 1916 CallKnownFunction(instr->hydrogen()->function(), | 1919 CallKnownFunction(instr->hydrogen()->function(), |
| 1917 instr->hydrogen()->formal_parameter_count(), | 1920 instr->hydrogen()->formal_parameter_count(), |
| 1918 instr->arity(), instr, CALL_AS_METHOD); | 1921 instr->arity(), instr, CALL_AS_FUNCTION); |
| 1919 } | 1922 } |
| 1920 | 1923 |
| 1921 | 1924 |
| 1922 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { | 1925 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { |
| 1923 ASSERT(ToRegister(instr->result()).is(x0)); | 1926 ASSERT(ToRegister(instr->result()).is(x0)); |
| 1924 CallKnownFunction(instr->hydrogen()->target(), | 1927 CallKnownFunction(instr->hydrogen()->target(), |
| 1925 instr->hydrogen()->formal_parameter_count(), | 1928 instr->hydrogen()->formal_parameter_count(), |
| 1926 instr->arity(), instr, CALL_AS_FUNCTION); | 1929 instr->arity(), instr, CALL_AS_FUNCTION); |
| 1927 } | 1930 } |
| 1928 | 1931 |
| 1929 | 1932 |
| 1930 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { | 1933 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { |
| 1931 ASSERT(ToRegister(instr->result()).is(x0)); | 1934 ASSERT(ToRegister(instr->result()).is(x0)); |
| 1932 | 1935 |
| 1933 int arity = instr->arity(); | 1936 int arity = instr->arity(); |
| 1934 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; | |
| 1935 Handle<Code> ic = | 1937 Handle<Code> ic = |
| 1936 isolate()->stub_cache()->ComputeCallInitialize(arity, mode); | 1938 isolate()->stub_cache()->ComputeCallInitialize(arity, CONTEXTUAL); |
| 1937 __ Mov(x2, Operand(instr->name())); | 1939 __ Mov(x2, Operand(instr->name())); |
| 1938 CallCode(ic, mode, instr); | 1940 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 1939 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 1941 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 1940 } | 1942 } |
| 1941 | 1943 |
| 1942 | 1944 |
| 1943 void LCodeGen::DoCallKeyed(LCallKeyed* instr) { | 1945 void LCodeGen::DoCallKeyed(LCallKeyed* instr) { |
| 1944 ASSERT(ToRegister(instr->key()).Is(x2)); | 1946 ASSERT(ToRegister(instr->key()).Is(x2)); |
| 1945 ASSERT(ToRegister(instr->result()).Is(x0)); | 1947 ASSERT(ToRegister(instr->result()).Is(x0)); |
| 1946 | 1948 |
| 1947 int arity = instr->arity(); | 1949 int arity = instr->arity(); |
| 1948 Handle<Code> ic = | 1950 Handle<Code> ic = |
| 1949 isolate()->stub_cache()->ComputeKeyedCallInitialize(arity); | 1951 isolate()->stub_cache()->ComputeKeyedCallInitialize(arity); |
| 1950 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 1952 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 1951 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 1953 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 1952 } | 1954 } |
| 1953 | 1955 |
| 1954 | 1956 |
| 1955 void LCodeGen::DoCallNamed(LCallNamed* instr) { | 1957 void LCodeGen::DoCallNamed(LCallNamed* instr) { |
| 1956 ASSERT(ToRegister(instr->result()).is(x0)); | 1958 ASSERT(ToRegister(instr->result()).is(x0)); |
| 1957 | 1959 |
| 1958 int arity = instr->arity(); | 1960 int arity = instr->arity(); |
| 1959 RelocInfo::Mode mode = RelocInfo::CODE_TARGET; | |
| 1960 Handle<Code> ic = | 1961 Handle<Code> ic = |
| 1961 isolate()->stub_cache()->ComputeCallInitialize(arity, mode); | 1962 isolate()->stub_cache()->ComputeCallInitialize(arity, NOT_CONTEXTUAL); |
| 1962 | 1963 |
| 1963 // IC needs a pointer to the name of the function to be called in x2. | 1964 // IC needs a pointer to the name of the function to be called in x2. |
| 1964 __ Mov(x2, Operand(instr->name())); | 1965 __ Mov(x2, Operand(instr->name())); |
| 1965 CallCode(ic, mode, instr); | 1966 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 1966 // Restore context register. | 1967 // Restore context register. |
| 1967 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 1968 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 1968 } | 1969 } |
| 1969 | 1970 |
| 1970 | 1971 |
| 1971 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { | 1972 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { |
| 1972 CallRuntime(instr->function(), instr->arity(), instr); | 1973 CallRuntime(instr->function(), instr->arity(), instr); |
| 1973 } | 1974 } |
| 1974 | 1975 |
| 1975 | 1976 |
| (...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3058 void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) { | 3059 void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) { |
| 3059 // The function is required to be in x1. | 3060 // The function is required to be in x1. |
| 3060 ASSERT(ToRegister(instr->function()).is(x1)); | 3061 ASSERT(ToRegister(instr->function()).is(x1)); |
| 3061 ASSERT(instr->HasPointerMap()); | 3062 ASSERT(instr->HasPointerMap()); |
| 3062 | 3063 |
| 3063 Handle<JSFunction> known_function = instr->hydrogen()->known_function(); | 3064 Handle<JSFunction> known_function = instr->hydrogen()->known_function(); |
| 3064 if (known_function.is_null()) { | 3065 if (known_function.is_null()) { |
| 3065 LPointerMap* pointers = instr->pointer_map(); | 3066 LPointerMap* pointers = instr->pointer_map(); |
| 3066 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); | 3067 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); |
| 3067 ParameterCount count(instr->arity()); | 3068 ParameterCount count(instr->arity()); |
| 3068 __ InvokeFunction(x1, count, CALL_FUNCTION, generator, CALL_AS_METHOD); | 3069 __ InvokeFunction(x1, count, CALL_FUNCTION, generator, CALL_AS_FUNCTION); |
| 3069 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3070 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 3070 } else { | 3071 } else { |
| 3071 CallKnownFunction(known_function, | 3072 CallKnownFunction(known_function, |
| 3072 instr->hydrogen()->formal_parameter_count(), | 3073 instr->hydrogen()->formal_parameter_count(), |
| 3073 instr->arity(), | 3074 instr->arity(), |
| 3074 instr, | 3075 instr, |
| 3075 CALL_AS_METHOD, | 3076 CALL_AS_FUNCTION, |
| 3076 x1); | 3077 x1); |
| 3077 } | 3078 } |
| 3078 } | 3079 } |
| 3079 | 3080 |
| 3080 | 3081 |
| 3081 void LCodeGen::DoIsConstructCallAndBranch(LIsConstructCallAndBranch* instr) { | 3082 void LCodeGen::DoIsConstructCallAndBranch(LIsConstructCallAndBranch* instr) { |
| 3082 Register temp1 = ToRegister(instr->temp1()); | 3083 Register temp1 = ToRegister(instr->temp1()); |
| 3083 Register temp2 = ToRegister(instr->temp2()); | 3084 Register temp2 = ToRegister(instr->temp2()); |
| 3084 | 3085 |
| 3085 // Get the frame pointer for the calling frame. | 3086 // Get the frame pointer for the calling frame. |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3274 DeoptimizeIfRoot( | 3275 DeoptimizeIfRoot( |
| 3275 result, Heap::kTheHoleValueRootIndex, instr->environment()); | 3276 result, Heap::kTheHoleValueRootIndex, instr->environment()); |
| 3276 } | 3277 } |
| 3277 } | 3278 } |
| 3278 | 3279 |
| 3279 | 3280 |
| 3280 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { | 3281 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { |
| 3281 ASSERT(ToRegister(instr->global_object()).Is(x0)); | 3282 ASSERT(ToRegister(instr->global_object()).Is(x0)); |
| 3282 ASSERT(ToRegister(instr->result()).Is(x0)); | 3283 ASSERT(ToRegister(instr->result()).Is(x0)); |
| 3283 __ Mov(x2, Operand(instr->name())); | 3284 __ Mov(x2, Operand(instr->name())); |
| 3284 RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET | 3285 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; |
| 3285 : RelocInfo::CODE_TARGET_CONTEXT; | 3286 Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode); |
| 3286 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 3287 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 3287 CallCode(ic, mode, instr); | |
| 3288 } | 3288 } |
| 3289 | 3289 |
| 3290 | 3290 |
| 3291 MemOperand LCodeGen::PrepareKeyedExternalArrayOperand(Register key, | 3291 MemOperand LCodeGen::PrepareKeyedExternalArrayOperand(Register key, |
| 3292 Register base, | 3292 Register base, |
| 3293 Register scratch, | 3293 Register scratch, |
| 3294 bool key_is_smi, | 3294 bool key_is_smi, |
| 3295 bool key_is_constant, | 3295 bool key_is_constant, |
| 3296 int constant_key, | 3296 int constant_key, |
| 3297 int element_size_shift, | 3297 int element_size_shift, |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3532 __ Load(result, FieldMemOperand(source, offset), access.representation()); | 3532 __ Load(result, FieldMemOperand(source, offset), access.representation()); |
| 3533 } | 3533 } |
| 3534 } | 3534 } |
| 3535 | 3535 |
| 3536 | 3536 |
| 3537 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { | 3537 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { |
| 3538 // LoadIC expects x2 to hold the name, and x0 to hold the receiver. | 3538 // LoadIC expects x2 to hold the name, and x0 to hold the receiver. |
| 3539 ASSERT(ToRegister(instr->object()).is(x0)); | 3539 ASSERT(ToRegister(instr->object()).is(x0)); |
| 3540 __ Mov(x2, Operand(instr->name())); | 3540 __ Mov(x2, Operand(instr->name())); |
| 3541 | 3541 |
| 3542 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 3542 Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); |
| 3543 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3543 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 3544 | 3544 |
| 3545 ASSERT(ToRegister(instr->result()).is(x0)); | 3545 ASSERT(ToRegister(instr->result()).is(x0)); |
| 3546 } | 3546 } |
| 3547 | 3547 |
| 3548 | 3548 |
| 3549 void LCodeGen::DoLoadRoot(LLoadRoot* instr) { | 3549 void LCodeGen::DoLoadRoot(LLoadRoot* instr) { |
| 3550 Register result = ToRegister(instr->result()); | 3550 Register result = ToRegister(instr->result()); |
| 3551 __ LoadRoot(result, instr->index()); | 3551 __ LoadRoot(result, instr->index()); |
| 3552 } | 3552 } |
| (...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4783 __ Str(value, FieldMemOperand(cell, Cell::kValueOffset)); | 4783 __ Str(value, FieldMemOperand(cell, Cell::kValueOffset)); |
| 4784 // Cells are always rescanned, so no write barrier here. | 4784 // Cells are always rescanned, so no write barrier here. |
| 4785 } | 4785 } |
| 4786 | 4786 |
| 4787 | 4787 |
| 4788 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { | 4788 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { |
| 4789 ASSERT(ToRegister(instr->global_object()).Is(x1)); | 4789 ASSERT(ToRegister(instr->global_object()).Is(x1)); |
| 4790 ASSERT(ToRegister(instr->value()).Is(x0)); | 4790 ASSERT(ToRegister(instr->value()).Is(x0)); |
| 4791 | 4791 |
| 4792 __ Mov(x2, Operand(instr->name())); | 4792 __ Mov(x2, Operand(instr->name())); |
| 4793 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) | 4793 Handle<Code> ic = StoreIC::initialize_stub(isolate(), |
| 4794 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 4794 instr->strict_mode_flag(), |
| 4795 : isolate()->builtins()->StoreIC_Initialize(); | 4795 CONTEXTUAL); |
| 4796 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); | 4796 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 4797 } | 4797 } |
| 4798 | 4798 |
| 4799 | 4799 |
| 4800 void LCodeGen::DoStoreKeyedExternal(LStoreKeyedExternal* instr) { | 4800 void LCodeGen::DoStoreKeyedExternal(LStoreKeyedExternal* instr) { |
| 4801 Register ext_ptr = ToRegister(instr->elements()); | 4801 Register ext_ptr = ToRegister(instr->elements()); |
| 4802 Register key = no_reg; | 4802 Register key = no_reg; |
| 4803 Register scratch; | 4803 Register scratch; |
| 4804 ElementsKind elements_kind = instr->elements_kind(); | 4804 ElementsKind elements_kind = instr->elements_kind(); |
| 4805 | 4805 |
| 4806 bool key_is_smi = instr->hydrogen()->key()->representation().IsSmi(); | 4806 bool key_is_smi = instr->hydrogen()->key()->representation().IsSmi(); |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5016 } | 5016 } |
| 5017 } | 5017 } |
| 5018 | 5018 |
| 5019 | 5019 |
| 5020 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { | 5020 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
| 5021 ASSERT(ToRegister(instr->value()).is(x0)); | 5021 ASSERT(ToRegister(instr->value()).is(x0)); |
| 5022 ASSERT(ToRegister(instr->object()).is(x1)); | 5022 ASSERT(ToRegister(instr->object()).is(x1)); |
| 5023 | 5023 |
| 5024 // Name must be in x2. | 5024 // Name must be in x2. |
| 5025 __ Mov(x2, Operand(instr->name())); | 5025 __ Mov(x2, Operand(instr->name())); |
| 5026 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) | 5026 Handle<Code> ic = StoreIC::initialize_stub(isolate(), |
| 5027 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 5027 instr->strict_mode_flag(), |
| 5028 : isolate()->builtins()->StoreIC_Initialize(); | 5028 NOT_CONTEXTUAL); |
| 5029 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 5029 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 5030 } | 5030 } |
| 5031 | 5031 |
| 5032 | 5032 |
| 5033 void LCodeGen::DoStringAdd(LStringAdd* instr) { | 5033 void LCodeGen::DoStringAdd(LStringAdd* instr) { |
| 5034 Register left = ToRegister(instr->left()); | 5034 Register left = ToRegister(instr->left()); |
| 5035 Register right = ToRegister(instr->right()); | 5035 Register right = ToRegister(instr->right()); |
| 5036 if (FLAG_new_string_add) { | 5036 if (FLAG_new_string_add) { |
| 5037 ASSERT(left.Is(x1)); | 5037 ASSERT(left.Is(x1)); |
| 5038 ASSERT(right.Is(x0)); | 5038 ASSERT(right.Is(x0)); |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5590 __ B(ge, &done); | 5590 __ B(ge, &done); |
| 5591 // Otherwise, fall through to deopt. | 5591 // Otherwise, fall through to deopt. |
| 5592 | 5592 |
| 5593 __ Bind(&deopt); | 5593 __ Bind(&deopt); |
| 5594 Deoptimize(instr->environment()); | 5594 Deoptimize(instr->environment()); |
| 5595 | 5595 |
| 5596 __ Bind(&global_object); | 5596 __ Bind(&global_object); |
| 5597 // We could load directly into the result register here, but the additional | 5597 // We could load directly into the result register here, but the additional |
| 5598 // branches required are likely to be more time consuming than one additional | 5598 // branches required are likely to be more time consuming than one additional |
| 5599 // move. | 5599 // move. |
| 5600 __ Ldr(receiver, GlobalObjectMemOperand()); | 5600 // TODO(jbramley): This looks broken on ARM. There, a Context::SlotOffset() is |
| 5601 __ Ldr(receiver, FieldMemOperand(receiver, | 5601 // passed into ContextOperand. |
| 5602 JSGlobalObject::kGlobalReceiverOffset)); | 5602 __ Ldr(receiver, FieldMemOperand(function, JSFunction::kContextOffset)); |
| 5603 __ Ldr(receiver, ContextMemOperand(receiver, Context::GLOBAL_OBJECT_INDEX)); |
| 5604 __ Ldr(receiver, |
| 5605 FieldMemOperand(receiver, GlobalObject::kGlobalReceiverOffset)); |
| 5606 |
| 5603 __ Bind(&done); | 5607 __ Bind(&done); |
| 5604 | |
| 5605 __ Mov(result, receiver); | 5608 __ Mov(result, receiver); |
| 5606 } | 5609 } |
| 5607 | 5610 |
| 5608 | 5611 |
| 5609 void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) { | 5612 void LCodeGen::DoLoadFieldByIndex(LLoadFieldByIndex* instr) { |
| 5610 Register object = ToRegister(instr->object()); | 5613 Register object = ToRegister(instr->object()); |
| 5611 Register index = ToRegister(instr->index()); | 5614 Register index = ToRegister(instr->index()); |
| 5612 Register result = ToRegister(instr->result()); | 5615 Register result = ToRegister(instr->result()); |
| 5613 | 5616 |
| 5614 __ AssertSmi(index); | 5617 __ AssertSmi(index); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 5626 __ Bind(&out_of_object); | 5629 __ Bind(&out_of_object); |
| 5627 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 5630 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
| 5628 // Index is equal to negated out of object property index plus 1. | 5631 // Index is equal to negated out of object property index plus 1. |
| 5629 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); | 5632 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
| 5630 __ Ldr(result, FieldMemOperand(result, | 5633 __ Ldr(result, FieldMemOperand(result, |
| 5631 FixedArray::kHeaderSize - kPointerSize)); | 5634 FixedArray::kHeaderSize - kPointerSize)); |
| 5632 __ Bind(&done); | 5635 __ Bind(&done); |
| 5633 } | 5636 } |
| 5634 | 5637 |
| 5635 } } // namespace v8::internal | 5638 } } // namespace v8::internal |
| OLD | NEW |