OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 // The frame pointer does not point to a JS frame so we save NULL for | 748 // The frame pointer does not point to a JS frame so we save NULL for |
749 // ebp. We expect the code throwing an exception to check ebp before | 749 // ebp. We expect the code throwing an exception to check ebp before |
750 // dereferencing it to restore the context. | 750 // dereferencing it to restore the context. |
751 push(Immediate(0)); // NULL frame pointer. | 751 push(Immediate(0)); // NULL frame pointer. |
752 push(Immediate(Smi::FromInt(0))); // No context. | 752 push(Immediate(Smi::FromInt(0))); // No context. |
753 state |= StackHandler::KindField::encode(StackHandler::ENTRY); | 753 state |= StackHandler::KindField::encode(StackHandler::ENTRY); |
754 } | 754 } |
755 | 755 |
756 // Push the state and the code object. | 756 // Push the state and the code object. |
757 push(Immediate(state)); | 757 push(Immediate(state)); |
758 push(CodeObject()); | 758 Push(CodeObject()); |
759 | 759 |
760 // Link the current handler as the next handler. | 760 // Link the current handler as the next handler. |
761 ExternalReference handler_address(Isolate::kHandlerAddress, isolate()); | 761 ExternalReference handler_address(Isolate::kHandlerAddress, isolate()); |
762 push(Operand::StaticVariable(handler_address)); | 762 push(Operand::StaticVariable(handler_address)); |
763 // Set this new handler as the current one. | 763 // Set this new handler as the current one. |
764 mov(Operand::StaticVariable(handler_address), esp); | 764 mov(Operand::StaticVariable(handler_address), esp); |
765 } | 765 } |
766 | 766 |
767 | 767 |
768 void MacroAssembler::PopTryHandler() { | 768 void MacroAssembler::PopTryHandler() { |
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2015 | 2015 |
2016 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, | 2016 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, |
2017 const ParameterCount& actual, | 2017 const ParameterCount& actual, |
2018 InvokeFlag flag, | 2018 InvokeFlag flag, |
2019 const CallWrapper& call_wrapper, | 2019 const CallWrapper& call_wrapper, |
2020 CallKind call_kind) { | 2020 CallKind call_kind) { |
2021 // You can't call a function without a valid frame. | 2021 // You can't call a function without a valid frame. |
2022 ASSERT(flag == JUMP_FUNCTION || has_frame()); | 2022 ASSERT(flag == JUMP_FUNCTION || has_frame()); |
2023 | 2023 |
2024 // Get the function and setup the context. | 2024 // Get the function and setup the context. |
2025 mov(edi, Immediate(function)); | 2025 LoadHeapObject(edi, function); |
2026 mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); | 2026 mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); |
2027 | 2027 |
2028 ParameterCount expected(function->shared()->formal_parameter_count()); | 2028 ParameterCount expected(function->shared()->formal_parameter_count()); |
2029 // We call indirectly through the code field in the function to | 2029 // We call indirectly through the code field in the function to |
2030 // allow recompilation to take effect without changing any of the | 2030 // allow recompilation to take effect without changing any of the |
2031 // call sites. | 2031 // call sites. |
2032 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), | 2032 InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset), |
2033 expected, actual, flag, call_wrapper, call_kind); | 2033 expected, actual, flag, call_wrapper, call_kind); |
2034 } | 2034 } |
2035 | 2035 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2144 | 2144 |
2145 int MacroAssembler::SafepointRegisterStackIndex(int reg_code) { | 2145 int MacroAssembler::SafepointRegisterStackIndex(int reg_code) { |
2146 // The registers are pushed starting with the lowest encoding, | 2146 // The registers are pushed starting with the lowest encoding, |
2147 // which means that lowest encodings are furthest away from | 2147 // which means that lowest encodings are furthest away from |
2148 // the stack pointer. | 2148 // the stack pointer. |
2149 ASSERT(reg_code >= 0 && reg_code < kNumSafepointRegisters); | 2149 ASSERT(reg_code >= 0 && reg_code < kNumSafepointRegisters); |
2150 return kNumSafepointRegisters - reg_code - 1; | 2150 return kNumSafepointRegisters - reg_code - 1; |
2151 } | 2151 } |
2152 | 2152 |
2153 | 2153 |
| 2154 void MacroAssembler::LoadHeapObject(Register result, |
| 2155 Handle<HeapObject> object) { |
| 2156 if (isolate()->heap()->InNewSpace(*object)) { |
| 2157 Handle<JSGlobalPropertyCell> cell = |
| 2158 isolate()->factory()->NewJSGlobalPropertyCell(object); |
| 2159 mov(result, Operand::Cell(cell)); |
| 2160 } else { |
| 2161 mov(result, object); |
| 2162 } |
| 2163 } |
| 2164 |
| 2165 |
| 2166 void MacroAssembler::PushHeapObject(Handle<HeapObject> object) { |
| 2167 if (isolate()->heap()->InNewSpace(*object)) { |
| 2168 Handle<JSGlobalPropertyCell> cell = |
| 2169 isolate()->factory()->NewJSGlobalPropertyCell(object); |
| 2170 push(Operand::Cell(cell)); |
| 2171 } else { |
| 2172 Push(object); |
| 2173 } |
| 2174 } |
| 2175 |
| 2176 |
2154 void MacroAssembler::Ret() { | 2177 void MacroAssembler::Ret() { |
2155 ret(0); | 2178 ret(0); |
2156 } | 2179 } |
2157 | 2180 |
2158 | 2181 |
2159 void MacroAssembler::Ret(int bytes_dropped, Register scratch) { | 2182 void MacroAssembler::Ret(int bytes_dropped, Register scratch) { |
2160 if (is_uint16(bytes_dropped)) { | 2183 if (is_uint16(bytes_dropped)) { |
2161 ret(bytes_dropped); | 2184 ret(bytes_dropped); |
2162 } else { | 2185 } else { |
2163 pop(scratch); | 2186 pop(scratch); |
(...skipping 11 matching lines...) Expand all Loading... |
2175 } | 2198 } |
2176 | 2199 |
2177 | 2200 |
2178 void MacroAssembler::Move(Register dst, Register src) { | 2201 void MacroAssembler::Move(Register dst, Register src) { |
2179 if (!dst.is(src)) { | 2202 if (!dst.is(src)) { |
2180 mov(dst, src); | 2203 mov(dst, src); |
2181 } | 2204 } |
2182 } | 2205 } |
2183 | 2206 |
2184 | 2207 |
2185 void MacroAssembler::Move(Register dst, Handle<Object> value) { | |
2186 mov(dst, value); | |
2187 } | |
2188 | |
2189 | |
2190 void MacroAssembler::SetCounter(StatsCounter* counter, int value) { | 2208 void MacroAssembler::SetCounter(StatsCounter* counter, int value) { |
2191 if (FLAG_native_code_counters && counter->Enabled()) { | 2209 if (FLAG_native_code_counters && counter->Enabled()) { |
2192 mov(Operand::StaticVariable(ExternalReference(counter)), Immediate(value)); | 2210 mov(Operand::StaticVariable(ExternalReference(counter)), Immediate(value)); |
2193 } | 2211 } |
2194 } | 2212 } |
2195 | 2213 |
2196 | 2214 |
2197 void MacroAssembler::IncrementCounter(StatsCounter* counter, int value) { | 2215 void MacroAssembler::IncrementCounter(StatsCounter* counter, int value) { |
2198 ASSERT(value > 0); | 2216 ASSERT(value > 0); |
2199 if (FLAG_native_code_counters && counter->Enabled()) { | 2217 if (FLAG_native_code_counters && counter->Enabled()) { |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2659 cmp(length, Operand(bitmap_scratch, MemoryChunk::kSizeOffset)); | 2677 cmp(length, Operand(bitmap_scratch, MemoryChunk::kSizeOffset)); |
2660 Check(less_equal, "Live Bytes Count overflow chunk size"); | 2678 Check(less_equal, "Live Bytes Count overflow chunk size"); |
2661 } | 2679 } |
2662 | 2680 |
2663 bind(&done); | 2681 bind(&done); |
2664 } | 2682 } |
2665 | 2683 |
2666 } } // namespace v8::internal | 2684 } } // namespace v8::internal |
2667 | 2685 |
2668 #endif // V8_TARGET_ARCH_IA32 | 2686 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |