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 2154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2165 movq(kScratchRegister, c_entry_fp_address); | 2165 movq(kScratchRegister, c_entry_fp_address); |
2166 movq(Operand(kScratchRegister, 0), Immediate(0)); | 2166 movq(Operand(kScratchRegister, 0), Immediate(0)); |
2167 } | 2167 } |
2168 | 2168 |
2169 | 2169 |
2170 Register MacroAssembler::CheckMaps(JSObject* object, | 2170 Register MacroAssembler::CheckMaps(JSObject* object, |
2171 Register object_reg, | 2171 Register object_reg, |
2172 JSObject* holder, | 2172 JSObject* holder, |
2173 Register holder_reg, | 2173 Register holder_reg, |
2174 Register scratch, | 2174 Register scratch, |
| 2175 int save_at_depth, |
2175 Label* miss) { | 2176 Label* miss) { |
2176 // Make sure there's no overlap between scratch and the other | 2177 // Make sure there's no overlap between scratch and the other |
2177 // registers. | 2178 // registers. |
2178 ASSERT(!scratch.is(object_reg) && !scratch.is(holder_reg)); | 2179 ASSERT(!scratch.is(object_reg) && !scratch.is(holder_reg)); |
2179 | 2180 |
2180 // Keep track of the current object in register reg. On the first | 2181 // Keep track of the current object in register reg. On the first |
2181 // iteration, reg is an alias for object_reg, on later iterations, | 2182 // iteration, reg is an alias for object_reg, on later iterations, |
2182 // it is an alias for holder_reg. | 2183 // it is an alias for holder_reg. |
2183 Register reg = object_reg; | 2184 Register reg = object_reg; |
2184 int depth = 1; | 2185 int depth = 0; |
| 2186 |
| 2187 if (save_at_depth == depth) { |
| 2188 movq(Operand(rsp, kPointerSize), reg); |
| 2189 } |
2185 | 2190 |
2186 // Check the maps in the prototype chain. | 2191 // Check the maps in the prototype chain. |
2187 // Traverse the prototype chain from the object and do map checks. | 2192 // Traverse the prototype chain from the object and do map checks. |
2188 while (object != holder) { | 2193 while (object != holder) { |
2189 depth++; | 2194 depth++; |
2190 | 2195 |
2191 // Only global objects and objects that do not require access | 2196 // Only global objects and objects that do not require access |
2192 // checks are allowed in stubs. | 2197 // checks are allowed in stubs. |
2193 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); | 2198 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); |
2194 | 2199 |
(...skipping 29 matching lines...) Expand all Loading... |
2224 // after the map check so that we know that the object is | 2229 // after the map check so that we know that the object is |
2225 // actually a global object. | 2230 // actually a global object. |
2226 if (object->IsJSGlobalProxy()) { | 2231 if (object->IsJSGlobalProxy()) { |
2227 CheckAccessGlobalProxy(reg, scratch, miss); | 2232 CheckAccessGlobalProxy(reg, scratch, miss); |
2228 } | 2233 } |
2229 // The prototype is in old space; load it directly. | 2234 // The prototype is in old space; load it directly. |
2230 reg = holder_reg; // from now the object is in holder_reg | 2235 reg = holder_reg; // from now the object is in holder_reg |
2231 Move(reg, Handle<JSObject>(prototype)); | 2236 Move(reg, Handle<JSObject>(prototype)); |
2232 } | 2237 } |
2233 | 2238 |
| 2239 if (save_at_depth == depth) { |
| 2240 movq(Operand(rsp, kPointerSize), reg); |
| 2241 } |
| 2242 |
2234 // Go to the next object in the prototype chain. | 2243 // Go to the next object in the prototype chain. |
2235 object = prototype; | 2244 object = prototype; |
2236 } | 2245 } |
2237 | 2246 |
2238 // Check the holder map. | 2247 // Check the holder map. |
2239 Cmp(FieldOperand(reg, HeapObject::kMapOffset), Handle<Map>(holder->map())); | 2248 Cmp(FieldOperand(reg, HeapObject::kMapOffset), Handle<Map>(holder->map())); |
2240 j(not_equal, miss); | 2249 j(not_equal, miss); |
2241 | 2250 |
2242 // Log the check depth. | 2251 // Log the check depth. |
2243 LOG(IntEvent("check-maps-depth", depth)); | 2252 LOG(IntEvent("check-maps-depth", depth + 1)); |
2244 | 2253 |
2245 // Perform security check for access to the global object and return | 2254 // Perform security check for access to the global object and return |
2246 // the holder register. | 2255 // the holder register. |
2247 ASSERT(object == holder); | 2256 ASSERT(object == holder); |
2248 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); | 2257 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); |
2249 if (object->IsJSGlobalProxy()) { | 2258 if (object->IsJSGlobalProxy()) { |
2250 CheckAccessGlobalProxy(reg, scratch, miss); | 2259 CheckAccessGlobalProxy(reg, scratch, miss); |
2251 } | 2260 } |
2252 return reg; | 2261 return reg; |
2253 } | 2262 } |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2679 CodePatcher::~CodePatcher() { | 2688 CodePatcher::~CodePatcher() { |
2680 // Indicate that code has changed. | 2689 // Indicate that code has changed. |
2681 CPU::FlushICache(address_, size_); | 2690 CPU::FlushICache(address_, size_); |
2682 | 2691 |
2683 // Check that the code was patched as expected. | 2692 // Check that the code was patched as expected. |
2684 ASSERT(masm_.pc_ == address_ + size_); | 2693 ASSERT(masm_.pc_ == address_ + size_); |
2685 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2694 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
2686 } | 2695 } |
2687 | 2696 |
2688 } } // namespace v8::internal | 2697 } } // namespace v8::internal |
OLD | NEW |