| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 24 matching lines...) Expand all Loading... |
| 35 #include "macro-assembler.h" | 35 #include "macro-assembler.h" |
| 36 | 36 |
| 37 namespace v8 { | 37 namespace v8 { |
| 38 namespace internal { | 38 namespace internal { |
| 39 | 39 |
| 40 | 40 |
| 41 Address IC::address() const { | 41 Address IC::address() const { |
| 42 // Get the address of the call. | 42 // Get the address of the call. |
| 43 Address result = Assembler::target_address_from_return_address(pc()); | 43 Address result = Assembler::target_address_from_return_address(pc()); |
| 44 | 44 |
| 45 #ifdef ENABLE_DEBUGGER_SUPPORT | |
| 46 Debug* debug = isolate()->debug(); | 45 Debug* debug = isolate()->debug(); |
| 47 // First check if any break points are active if not just return the address | 46 // First check if any break points are active if not just return the address |
| 48 // of the call. | 47 // of the call. |
| 49 if (!debug->has_break_points()) return result; | 48 if (!debug->has_break_points()) return result; |
| 50 | 49 |
| 51 // At least one break point is active perform additional test to ensure that | 50 // At least one break point is active perform additional test to ensure that |
| 52 // break point locations are updated correctly. | 51 // break point locations are updated correctly. |
| 53 if (debug->IsDebugBreak(Assembler::target_address_at(result, | 52 if (debug->IsDebugBreak(Assembler::target_address_at(result, |
| 54 raw_constant_pool()))) { | 53 raw_constant_pool()))) { |
| 55 // If the call site is a call to debug break then return the address in | 54 // If the call site is a call to debug break then return the address in |
| 56 // the original code instead of the address in the running code. This will | 55 // the original code instead of the address in the running code. This will |
| 57 // cause the original code to be updated and keeps the breakpoint active in | 56 // cause the original code to be updated and keeps the breakpoint active in |
| 58 // the running code. | 57 // the running code. |
| 59 Code* code = GetCode(); | 58 Code* code = GetCode(); |
| 60 Code* original_code = GetOriginalCode(); | 59 Code* original_code = GetOriginalCode(); |
| 61 intptr_t delta = | 60 intptr_t delta = |
| 62 original_code->instruction_start() - code->instruction_start(); | 61 original_code->instruction_start() - code->instruction_start(); |
| 63 // Return the address in the original code. This is the place where | 62 // Return the address in the original code. This is the place where |
| 64 // the call which has been overwritten by the DebugBreakXXX resides | 63 // the call which has been overwritten by the DebugBreakXXX resides |
| 65 // and the place where the inline cache system should look. | 64 // and the place where the inline cache system should look. |
| 66 return result + delta; | 65 return result + delta; |
| 67 } else { | 66 } else { |
| 68 // No break point here just return the address of the call. | 67 // No break point here just return the address of the call. |
| 69 return result; | 68 return result; |
| 70 } | 69 } |
| 71 #else | |
| 72 return result; | |
| 73 #endif | |
| 74 } | 70 } |
| 75 | 71 |
| 76 | 72 |
| 77 ConstantPoolArray* IC::constant_pool() const { | 73 ConstantPoolArray* IC::constant_pool() const { |
| 78 if (!FLAG_enable_ool_constant_pool) { | 74 if (!FLAG_enable_ool_constant_pool) { |
| 79 return NULL; | 75 return NULL; |
| 80 } else { | 76 } else { |
| 81 Handle<ConstantPoolArray> result = raw_constant_pool_; | 77 Handle<ConstantPoolArray> result = raw_constant_pool_; |
| 82 #ifdef ENABLE_DEBUGGER_SUPPORT | |
| 83 Debug* debug = isolate()->debug(); | 78 Debug* debug = isolate()->debug(); |
| 84 // First check if any break points are active if not just return the | 79 // First check if any break points are active if not just return the |
| 85 // original constant pool. | 80 // original constant pool. |
| 86 if (!debug->has_break_points()) return *result; | 81 if (!debug->has_break_points()) return *result; |
| 87 | 82 |
| 88 // At least one break point is active perform additional test to ensure that | 83 // At least one break point is active perform additional test to ensure that |
| 89 // break point locations are updated correctly. | 84 // break point locations are updated correctly. |
| 90 Address target = Assembler::target_address_from_return_address(pc()); | 85 Address target = Assembler::target_address_from_return_address(pc()); |
| 91 if (debug->IsDebugBreak( | 86 if (debug->IsDebugBreak( |
| 92 Assembler::target_address_at(target, raw_constant_pool()))) { | 87 Assembler::target_address_at(target, raw_constant_pool()))) { |
| 93 // If the call site is a call to debug break then we want to return the | 88 // If the call site is a call to debug break then we want to return the |
| 94 // constant pool for the original code instead of the breakpointed code. | 89 // constant pool for the original code instead of the breakpointed code. |
| 95 return GetOriginalCode()->constant_pool(); | 90 return GetOriginalCode()->constant_pool(); |
| 96 } | 91 } |
| 97 #endif | |
| 98 return *result; | 92 return *result; |
| 99 } | 93 } |
| 100 } | 94 } |
| 101 | 95 |
| 102 | 96 |
| 103 ConstantPoolArray* IC::raw_constant_pool() const { | 97 ConstantPoolArray* IC::raw_constant_pool() const { |
| 104 if (FLAG_enable_ool_constant_pool) { | 98 if (FLAG_enable_ool_constant_pool) { |
| 105 return *raw_constant_pool_; | 99 return *raw_constant_pool_; |
| 106 } else { | 100 } else { |
| 107 return NULL; | 101 return NULL; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 } | 190 } |
| 197 return handle(JSObject::cast(constructor->instance_prototype())->map()); | 191 return handle(JSObject::cast(constructor->instance_prototype())->map()); |
| 198 } | 192 } |
| 199 return TypeToMap(type, isolate); | 193 return TypeToMap(type, isolate); |
| 200 } | 194 } |
| 201 | 195 |
| 202 | 196 |
| 203 } } // namespace v8::internal | 197 } } // namespace v8::internal |
| 204 | 198 |
| 205 #endif // V8_IC_INL_H_ | 199 #endif // V8_IC_INL_H_ |
| OLD | NEW |