| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1541 ASSERT(JS_FUNCTION_TYPE == LAST_JS_OBJECT_TYPE + 1); | 1541 ASSERT(JS_FUNCTION_TYPE == LAST_JS_OBJECT_TYPE + 1); |
| 1542 __ CompareObjectType(r0, r1, r2, FIRST_JS_OBJECT_TYPE); | 1542 __ CompareObjectType(r0, r1, r2, FIRST_JS_OBJECT_TYPE); |
| 1543 __ b(lt, &build_args); | 1543 __ b(lt, &build_args); |
| 1544 | 1544 |
| 1545 // Check that applicand.apply is Function.prototype.apply. | 1545 // Check that applicand.apply is Function.prototype.apply. |
| 1546 __ ldr(r0, MemOperand(sp, kPointerSize)); | 1546 __ ldr(r0, MemOperand(sp, kPointerSize)); |
| 1547 __ BranchOnSmi(r0, &build_args); | 1547 __ BranchOnSmi(r0, &build_args); |
| 1548 __ CompareObjectType(r0, r1, r2, JS_FUNCTION_TYPE); | 1548 __ CompareObjectType(r0, r1, r2, JS_FUNCTION_TYPE); |
| 1549 __ b(ne, &build_args); | 1549 __ b(ne, &build_args); |
| 1550 __ ldr(r0, FieldMemOperand(r0, JSFunction::kSharedFunctionInfoOffset)); | 1550 __ ldr(r0, FieldMemOperand(r0, JSFunction::kSharedFunctionInfoOffset)); |
| 1551 Handle<Code> apply_code(Builtins::builtin(Builtins::FunctionApply)); | 1551 Handle<Code> apply_code( |
| 1552 Isolate::Current()->builtins()->builtin(Builtins::FunctionApply)); |
| 1552 __ ldr(r1, FieldMemOperand(r0, SharedFunctionInfo::kCodeOffset)); | 1553 __ ldr(r1, FieldMemOperand(r0, SharedFunctionInfo::kCodeOffset)); |
| 1553 __ cmp(r1, Operand(apply_code)); | 1554 __ cmp(r1, Operand(apply_code)); |
| 1554 __ b(ne, &build_args); | 1555 __ b(ne, &build_args); |
| 1555 | 1556 |
| 1556 // Check that applicand is a function. | 1557 // Check that applicand is a function. |
| 1557 __ ldr(r1, MemOperand(sp, 2 * kPointerSize)); | 1558 __ ldr(r1, MemOperand(sp, 2 * kPointerSize)); |
| 1558 __ BranchOnSmi(r1, &build_args); | 1559 __ BranchOnSmi(r1, &build_args); |
| 1559 __ CompareObjectType(r1, r2, r3, JS_FUNCTION_TYPE); | 1560 __ CompareObjectType(r1, r2, r3, JS_FUNCTION_TYPE); |
| 1560 __ b(ne, &build_args); | 1561 __ b(ne, &build_args); |
| 1561 | 1562 |
| (...skipping 1800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3362 Literal* key = property->key(); | 3363 Literal* key = property->key(); |
| 3363 Expression* value = property->value(); | 3364 Expression* value = property->value(); |
| 3364 switch (property->kind()) { | 3365 switch (property->kind()) { |
| 3365 case ObjectLiteral::Property::CONSTANT: | 3366 case ObjectLiteral::Property::CONSTANT: |
| 3366 break; | 3367 break; |
| 3367 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 3368 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
| 3368 if (CompileTimeValue::IsCompileTimeValue(property->value())) break; | 3369 if (CompileTimeValue::IsCompileTimeValue(property->value())) break; |
| 3369 // else fall through | 3370 // else fall through |
| 3370 case ObjectLiteral::Property::COMPUTED: | 3371 case ObjectLiteral::Property::COMPUTED: |
| 3371 if (key->handle()->IsSymbol()) { | 3372 if (key->handle()->IsSymbol()) { |
| 3372 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); | 3373 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 3374 Builtins::StoreIC_Initialize)); |
| 3373 Load(value); | 3375 Load(value); |
| 3374 frame_->EmitPop(r0); | 3376 frame_->EmitPop(r0); |
| 3375 __ mov(r2, Operand(key->handle())); | 3377 __ mov(r2, Operand(key->handle())); |
| 3376 __ ldr(r1, frame_->Top()); // Load the receiver. | 3378 __ ldr(r1, frame_->Top()); // Load the receiver. |
| 3377 frame_->CallCodeObject(ic, RelocInfo::CODE_TARGET, 0); | 3379 frame_->CallCodeObject(ic, RelocInfo::CODE_TARGET, 0); |
| 3378 break; | 3380 break; |
| 3379 } | 3381 } |
| 3380 // else fall through | 3382 // else fall through |
| 3381 case ObjectLiteral::Property::PROTOTYPE: { | 3383 case ObjectLiteral::Property::PROTOTYPE: { |
| 3382 __ ldr(r0, frame_->Top()); | 3384 __ ldr(r0, frame_->Top()); |
| (...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4167 VirtualFrame::SpilledScope spilled_scope(frame_); | 4169 VirtualFrame::SpilledScope spilled_scope(frame_); |
| 4168 | 4170 |
| 4169 // r0: the number of arguments. | 4171 // r0: the number of arguments. |
| 4170 __ mov(r0, Operand(arg_count)); | 4172 __ mov(r0, Operand(arg_count)); |
| 4171 // Load the function into r1 as per calling convention. | 4173 // Load the function into r1 as per calling convention. |
| 4172 __ ldr(r1, frame_->ElementAt(arg_count + 1)); | 4174 __ ldr(r1, frame_->ElementAt(arg_count + 1)); |
| 4173 | 4175 |
| 4174 // Call the construct call builtin that handles allocation and | 4176 // Call the construct call builtin that handles allocation and |
| 4175 // constructor invocation. | 4177 // constructor invocation. |
| 4176 CodeForSourcePosition(node->position()); | 4178 CodeForSourcePosition(node->position()); |
| 4177 Handle<Code> ic(Builtins::builtin(Builtins::JSConstructCall)); | 4179 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 4180 Builtins::JSConstructCall)); |
| 4178 frame_->CallCodeObject(ic, RelocInfo::CONSTRUCT_CALL, arg_count + 1); | 4181 frame_->CallCodeObject(ic, RelocInfo::CONSTRUCT_CALL, arg_count + 1); |
| 4179 | 4182 |
| 4180 // Discard old TOS value and push r0 on the stack (same as Pop(), push(r0)). | 4183 // Discard old TOS value and push r0 on the stack (same as Pop(), push(r0)). |
| 4181 __ str(r0, frame_->Top()); | 4184 __ str(r0, frame_->Top()); |
| 4182 ASSERT_EQ(original_height + 1, frame_->height()); | 4185 ASSERT_EQ(original_height + 1, frame_->height()); |
| 4183 } | 4186 } |
| 4184 | 4187 |
| 4185 | 4188 |
| 4186 void CodeGenerator::GenerateClassOf(ZoneList<Expression*>* args) { | 4189 void CodeGenerator::GenerateClassOf(ZoneList<Expression*>* args) { |
| 4187 VirtualFrame::SpilledScope spilled_scope(frame_); | 4190 VirtualFrame::SpilledScope spilled_scope(frame_); |
| (...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5156 int original_height = frame_->height(); | 5159 int original_height = frame_->height(); |
| 5157 #endif | 5160 #endif |
| 5158 if (CheckForInlineRuntimeCall(node)) { | 5161 if (CheckForInlineRuntimeCall(node)) { |
| 5159 ASSERT((has_cc() && frame_->height() == original_height) || | 5162 ASSERT((has_cc() && frame_->height() == original_height) || |
| 5160 (!has_cc() && frame_->height() == original_height + 1)); | 5163 (!has_cc() && frame_->height() == original_height + 1)); |
| 5161 return; | 5164 return; |
| 5162 } | 5165 } |
| 5163 | 5166 |
| 5164 ZoneList<Expression*>* args = node->arguments(); | 5167 ZoneList<Expression*>* args = node->arguments(); |
| 5165 Comment cmnt(masm_, "[ CallRuntime"); | 5168 Comment cmnt(masm_, "[ CallRuntime"); |
| 5166 Runtime::Function* function = node->function(); | 5169 const Runtime::Function* function = node->function(); |
| 5167 | 5170 |
| 5168 if (function == NULL) { | 5171 if (function == NULL) { |
| 5169 // Prepare stack for calling JS runtime function. | 5172 // Prepare stack for calling JS runtime function. |
| 5170 // Push the builtins object found in the current global object. | 5173 // Push the builtins object found in the current global object. |
| 5171 Register scratch = VirtualFrame::scratch0(); | 5174 Register scratch = VirtualFrame::scratch0(); |
| 5172 __ ldr(scratch, GlobalObject()); | 5175 __ ldr(scratch, GlobalObject()); |
| 5173 Register builtins = frame_->GetTOSRegister(); | 5176 Register builtins = frame_->GetTOSRegister(); |
| 5174 __ ldr(builtins, FieldMemOperand(scratch, GlobalObject::kBuiltinsOffset)); | 5177 __ ldr(builtins, FieldMemOperand(scratch, GlobalObject::kBuiltinsOffset)); |
| 5175 frame_->EmitPush(builtins); | 5178 frame_->EmitPush(builtins); |
| 5176 } | 5179 } |
| (...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5892 ASSERT(!receiver_.is(scratch1) && !receiver_.is(scratch2)); | 5895 ASSERT(!receiver_.is(scratch1) && !receiver_.is(scratch2)); |
| 5893 __ DecrementCounter(&Counters::named_load_inline, 1, scratch1, scratch2); | 5896 __ DecrementCounter(&Counters::named_load_inline, 1, scratch1, scratch2); |
| 5894 __ IncrementCounter(&Counters::named_load_inline_miss, 1, scratch1, scratch2); | 5897 __ IncrementCounter(&Counters::named_load_inline_miss, 1, scratch1, scratch2); |
| 5895 | 5898 |
| 5896 // Ensure receiver in r0 and name in r2 to match load ic calling convention. | 5899 // Ensure receiver in r0 and name in r2 to match load ic calling convention. |
| 5897 __ Move(r0, receiver_); | 5900 __ Move(r0, receiver_); |
| 5898 __ mov(r2, Operand(name_)); | 5901 __ mov(r2, Operand(name_)); |
| 5899 | 5902 |
| 5900 // The rest of the instructions in the deferred code must be together. | 5903 // The rest of the instructions in the deferred code must be together. |
| 5901 { Assembler::BlockConstPoolScope block_const_pool(masm_); | 5904 { Assembler::BlockConstPoolScope block_const_pool(masm_); |
| 5902 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); | 5905 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 5906 Builtins::LoadIC_Initialize)); |
| 5903 __ Call(ic, RelocInfo::CODE_TARGET); | 5907 __ Call(ic, RelocInfo::CODE_TARGET); |
| 5904 // The call must be followed by a nop(1) instruction to indicate that the | 5908 // The call must be followed by a nop(1) instruction to indicate that the |
| 5905 // in-object has been inlined. | 5909 // in-object has been inlined. |
| 5906 __ nop(PROPERTY_ACCESS_INLINED); | 5910 __ nop(PROPERTY_ACCESS_INLINED); |
| 5907 | 5911 |
| 5908 // At this point the answer is in r0. We move it to the expected register | 5912 // At this point the answer is in r0. We move it to the expected register |
| 5909 // if necessary. | 5913 // if necessary. |
| 5910 __ Move(receiver_, r0); | 5914 __ Move(receiver_, r0); |
| 5911 | 5915 |
| 5912 // Now go back to the frame that we entered with. This will not overwrite | 5916 // Now go back to the frame that we entered with. This will not overwrite |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5951 | 5955 |
| 5952 // Ensure key in r0 and receiver in r1 to match keyed load ic calling | 5956 // Ensure key in r0 and receiver in r1 to match keyed load ic calling |
| 5953 // convention. | 5957 // convention. |
| 5954 if (key_.is(r1)) { | 5958 if (key_.is(r1)) { |
| 5955 __ Swap(r0, r1, ip); | 5959 __ Swap(r0, r1, ip); |
| 5956 } | 5960 } |
| 5957 | 5961 |
| 5958 // The rest of the instructions in the deferred code must be together. | 5962 // The rest of the instructions in the deferred code must be together. |
| 5959 { Assembler::BlockConstPoolScope block_const_pool(masm_); | 5963 { Assembler::BlockConstPoolScope block_const_pool(masm_); |
| 5960 // Call keyed load IC. It has the arguments key and receiver in r0 and r1. | 5964 // Call keyed load IC. It has the arguments key and receiver in r0 and r1. |
| 5961 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); | 5965 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 5966 Builtins::KeyedLoadIC_Initialize)); |
| 5962 __ Call(ic, RelocInfo::CODE_TARGET); | 5967 __ Call(ic, RelocInfo::CODE_TARGET); |
| 5963 // The call must be followed by a nop instruction to indicate that the | 5968 // The call must be followed by a nop instruction to indicate that the |
| 5964 // keyed load has been inlined. | 5969 // keyed load has been inlined. |
| 5965 __ nop(PROPERTY_ACCESS_INLINED); | 5970 __ nop(PROPERTY_ACCESS_INLINED); |
| 5966 | 5971 |
| 5967 // Block the constant pool for one more instruction after leaving this | 5972 // Block the constant pool for one more instruction after leaving this |
| 5968 // constant pool block scope to include the branch instruction ending the | 5973 // constant pool block scope to include the branch instruction ending the |
| 5969 // deferred code. | 5974 // deferred code. |
| 5970 __ BlockConstPoolFor(1); | 5975 __ BlockConstPoolFor(1); |
| 5971 } | 5976 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 6001 // calling convention. | 6006 // calling convention. |
| 6002 if (value_.is(r1)) { | 6007 if (value_.is(r1)) { |
| 6003 __ Swap(r0, r1, ip); | 6008 __ Swap(r0, r1, ip); |
| 6004 } | 6009 } |
| 6005 ASSERT(receiver_.is(r2)); | 6010 ASSERT(receiver_.is(r2)); |
| 6006 | 6011 |
| 6007 // The rest of the instructions in the deferred code must be together. | 6012 // The rest of the instructions in the deferred code must be together. |
| 6008 { Assembler::BlockConstPoolScope block_const_pool(masm_); | 6013 { Assembler::BlockConstPoolScope block_const_pool(masm_); |
| 6009 // Call keyed store IC. It has the arguments value, key and receiver in r0, | 6014 // Call keyed store IC. It has the arguments value, key and receiver in r0, |
| 6010 // r1 and r2. | 6015 // r1 and r2. |
| 6011 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); | 6016 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 6017 Builtins::KeyedStoreIC_Initialize)); |
| 6012 __ Call(ic, RelocInfo::CODE_TARGET); | 6018 __ Call(ic, RelocInfo::CODE_TARGET); |
| 6013 // The call must be followed by a nop instruction to indicate that the | 6019 // The call must be followed by a nop instruction to indicate that the |
| 6014 // keyed store has been inlined. | 6020 // keyed store has been inlined. |
| 6015 __ nop(PROPERTY_ACCESS_INLINED); | 6021 __ nop(PROPERTY_ACCESS_INLINED); |
| 6016 | 6022 |
| 6017 // Block the constant pool for one more instruction after leaving this | 6023 // Block the constant pool for one more instruction after leaving this |
| 6018 // constant pool block scope to include the branch instruction ending the | 6024 // constant pool block scope to include the branch instruction ending the |
| 6019 // deferred code. | 6025 // deferred code. |
| 6020 __ BlockConstPoolFor(1); | 6026 __ BlockConstPoolFor(1); |
| 6021 } | 6027 } |
| (...skipping 3529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9551 __ InvokeFunction(r1, actual, JUMP_FUNCTION); | 9557 __ InvokeFunction(r1, actual, JUMP_FUNCTION); |
| 9552 | 9558 |
| 9553 // Slow-case: Non-function called. | 9559 // Slow-case: Non-function called. |
| 9554 __ bind(&slow); | 9560 __ bind(&slow); |
| 9555 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead | 9561 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead |
| 9556 // of the original receiver from the call site). | 9562 // of the original receiver from the call site). |
| 9557 __ str(r1, MemOperand(sp, argc_ * kPointerSize)); | 9563 __ str(r1, MemOperand(sp, argc_ * kPointerSize)); |
| 9558 __ mov(r0, Operand(argc_)); // Setup the number of arguments. | 9564 __ mov(r0, Operand(argc_)); // Setup the number of arguments. |
| 9559 __ mov(r2, Operand(0)); | 9565 __ mov(r2, Operand(0)); |
| 9560 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); | 9566 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); |
| 9561 __ Jump(Handle<Code>(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)), | 9567 __ Jump(Handle<Code>(Isolate::Current()->builtins()->builtin( |
| 9562 RelocInfo::CODE_TARGET); | 9568 Builtins::ArgumentsAdaptorTrampoline)), RelocInfo::CODE_TARGET); |
| 9563 } | 9569 } |
| 9564 | 9570 |
| 9565 | 9571 |
| 9566 // Unfortunately you have to run without snapshots to see most of these | 9572 // Unfortunately you have to run without snapshots to see most of these |
| 9567 // names in the profile since most compare stubs end up in the snapshot. | 9573 // names in the profile since most compare stubs end up in the snapshot. |
| 9568 const char* CompareStub::GetName() { | 9574 const char* CompareStub::GetName() { |
| 9569 if (name_ != NULL) return name_; | 9575 if (name_ != NULL) return name_; |
| 9570 const int kMaxNameLength = 100; | 9576 const int kMaxNameLength = 100; |
| 9571 name_ = Bootstrapper::AllocateAutoDeletedArray(kMaxNameLength); | 9577 name_ = Bootstrapper::AllocateAutoDeletedArray(kMaxNameLength); |
| 9572 if (name_ == NULL) return "OOM"; | 9578 if (name_ == NULL) return "OOM"; |
| (...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10700 __ bind(&string_add_runtime); | 10706 __ bind(&string_add_runtime); |
| 10701 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); | 10707 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); |
| 10702 } | 10708 } |
| 10703 | 10709 |
| 10704 | 10710 |
| 10705 #undef __ | 10711 #undef __ |
| 10706 | 10712 |
| 10707 } } // namespace v8::internal | 10713 } } // namespace v8::internal |
| 10708 | 10714 |
| 10709 #endif // V8_TARGET_ARCH_ARM | 10715 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |