christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 1 | // Copyright (c) 1994-2006 Sun Microsystems Inc. |
| 2 | // All Rights Reserved. |
| 3 | // |
| 4 | // Redistribution and use in source and binary forms, with or without |
| 5 | // modification, are permitted provided that the following conditions are |
| 6 | // met: |
| 7 | // |
| 8 | // - Redistributions of source code must retain the above copyright notice, |
| 9 | // this list of conditions and the following disclaimer. |
| 10 | // |
| 11 | // - Redistribution in binary form must reproduce the above copyright |
| 12 | // notice, this list of conditions and the following disclaimer in the |
| 13 | // documentation and/or other materials provided with the distribution. |
| 14 | // |
| 15 | // - Neither the name of Sun Microsystems or the names of contributors may |
| 16 | // be used to endorse or promote products derived from this software without |
| 17 | // specific prior written permission. |
| 18 | // |
| 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS |
| 20 | // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
| 21 | // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 22 | // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
| 23 | // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 24 | // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 25 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 26 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 27 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 28 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 29 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | |
| 31 | // The original source code covered by the above license above has been |
| 32 | // modified significantly by Google Inc. |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 33 | // Copyright 2011 the V8 project authors. All rights reserved. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 34 | |
| 35 | #include "v8.h" |
| 36 | |
| 37 | #include "arguments.h" |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 38 | #include "deoptimizer.h" |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 39 | #include "execution.h" |
| 40 | #include "ic-inl.h" |
| 41 | #include "factory.h" |
| 42 | #include "runtime.h" |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 43 | #include "runtime-profiler.h" |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 44 | #include "serialize.h" |
| 45 | #include "stub-cache.h" |
ager@chromium.org | 3291210 | 2009-01-16 10:38:43 +0000 | [diff] [blame] | 46 | #include "regexp-stack.h" |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 47 | #include "ast.h" |
| 48 | #include "regexp-macro-assembler.h" |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 49 | #include "platform.h" |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 50 | // Include native regexp-macro-assembler. |
ricow@chromium.org | c9c8082 | 2010-04-21 08:22:37 +0000 | [diff] [blame] | 51 | #ifndef V8_INTERPRETED_REGEXP |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 52 | #if V8_TARGET_ARCH_IA32 |
| 53 | #include "ia32/regexp-macro-assembler-ia32.h" |
| 54 | #elif V8_TARGET_ARCH_X64 |
| 55 | #include "x64/regexp-macro-assembler-x64.h" |
| 56 | #elif V8_TARGET_ARCH_ARM |
| 57 | #include "arm/regexp-macro-assembler-arm.h" |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 58 | #elif V8_TARGET_ARCH_MIPS |
| 59 | #include "mips/regexp-macro-assembler-mips.h" |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 60 | #else // Unknown architecture. |
| 61 | #error "Unknown architecture." |
| 62 | #endif // Target architecture. |
ricow@chromium.org | c9c8082 | 2010-04-21 08:22:37 +0000 | [diff] [blame] | 63 | #endif // V8_INTERPRETED_REGEXP |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 64 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 65 | namespace v8 { |
| 66 | namespace internal { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 67 | |
| 68 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 69 | const double DoubleConstant::min_int = kMinInt; |
| 70 | const double DoubleConstant::one_half = 0.5; |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 71 | const double DoubleConstant::minus_zero = -0.0; |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 72 | const double DoubleConstant::nan = OS::nan_value(); |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 73 | const double DoubleConstant::negative_infinity = -V8_INFINITY; |
kmillikin@chromium.org | 49edbdf | 2011-02-16 12:32:18 +0000 | [diff] [blame] | 74 | const char* RelocInfo::kFillerCommentString = "DEOPTIMIZATION PADDING"; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 75 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 76 | // ----------------------------------------------------------------------------- |
vegorov@chromium.org | 7304bca | 2011-05-16 12:14:13 +0000 | [diff] [blame^] | 77 | // Implementation of AssemblerBase |
| 78 | |
| 79 | AssemblerBase::AssemblerBase(Isolate* isolate) |
| 80 | : isolate_(isolate), |
| 81 | jit_cookie_(0) { |
| 82 | if (FLAG_mask_constants_with_cookie && isolate != NULL) { |
| 83 | jit_cookie_ = V8::RandomPrivate(isolate); |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | |
| 88 | // ----------------------------------------------------------------------------- |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 89 | // Implementation of Label |
| 90 | |
| 91 | int Label::pos() const { |
| 92 | if (pos_ < 0) return -pos_ - 1; |
| 93 | if (pos_ > 0) return pos_ - 1; |
| 94 | UNREACHABLE(); |
| 95 | return 0; |
| 96 | } |
| 97 | |
| 98 | |
| 99 | // ----------------------------------------------------------------------------- |
| 100 | // Implementation of RelocInfoWriter and RelocIterator |
| 101 | // |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 102 | // Relocation information is written backwards in memory, from high addresses |
| 103 | // towards low addresses, byte by byte. Therefore, in the encodings listed |
| 104 | // below, the first byte listed it at the highest address, and successive |
| 105 | // bytes in the record are at progressively lower addresses. |
| 106 | // |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 107 | // Encoding |
| 108 | // |
| 109 | // The most common modes are given single-byte encodings. Also, it is |
| 110 | // easy to identify the type of reloc info and skip unwanted modes in |
| 111 | // an iteration. |
| 112 | // |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 113 | // The encoding relies on the fact that there are fewer than 14 |
| 114 | // different non-compactly encoded relocation modes. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 115 | // |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 116 | // The first byte of a relocation record has a tag in its low 2 bits: |
| 117 | // Here are the record schemes, depending on the low tag and optional higher |
| 118 | // tags. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 119 | // |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 120 | // Low tag: |
| 121 | // 00: embedded_object: [6-bit pc delta] 00 |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 122 | // |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 123 | // 01: code_target: [6-bit pc delta] 01 |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 124 | // |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 125 | // 10: short_data_record: [6-bit pc delta] 10 followed by |
| 126 | // [6-bit data delta] [2-bit data type tag] |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 127 | // |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 128 | // 11: long_record [2-bit high tag][4 bit middle_tag] 11 |
| 129 | // followed by variable data depending on type. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 130 | // |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 131 | // 2-bit data type tags, used in short_data_record and data_jump long_record: |
| 132 | // code_target_with_id: 00 |
| 133 | // position: 01 |
| 134 | // statement_position: 10 |
| 135 | // comment: 11 (not used in short_data_record) |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 136 | // |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 137 | // Long record format: |
| 138 | // 4-bit middle_tag: |
| 139 | // 0000 - 1100 : Short record for RelocInfo::Mode middle_tag + 2 |
| 140 | // (The middle_tag encodes rmode - RelocInfo::LAST_COMPACT_ENUM, |
| 141 | // and is between 0000 and 1100) |
| 142 | // The format is: |
| 143 | // 00 [4 bit middle_tag] 11 followed by |
| 144 | // 00 [6 bit pc delta] |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 145 | // |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 146 | // 1101: not used (would allow one more relocation mode to be added) |
| 147 | // 1110: long_data_record |
| 148 | // The format is: [2-bit data_type_tag] 1110 11 |
| 149 | // signed intptr_t, lowest byte written first |
| 150 | // (except data_type code_target_with_id, which |
| 151 | // is followed by a signed int, not intptr_t.) |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 152 | // |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 153 | // 1111: long_pc_jump |
| 154 | // The format is: |
| 155 | // pc-jump: 00 1111 11, |
| 156 | // 00 [6 bits pc delta] |
| 157 | // or |
| 158 | // pc-jump (variable length): |
| 159 | // 01 1111 11, |
| 160 | // [7 bits data] 0 |
| 161 | // ... |
| 162 | // [7 bits data] 1 |
| 163 | // (Bits 6..31 of pc delta, with leading zeroes |
| 164 | // dropped, and last non-zero chunk tagged with 1.) |
| 165 | |
| 166 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 167 | const int kMaxRelocModes = 14; |
| 168 | |
| 169 | const int kTagBits = 2; |
| 170 | const int kTagMask = (1 << kTagBits) - 1; |
| 171 | const int kExtraTagBits = 4; |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 172 | const int kLocatableTypeTagBits = 2; |
| 173 | const int kSmallDataBits = kBitsPerByte - kLocatableTypeTagBits; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 174 | |
| 175 | const int kEmbeddedObjectTag = 0; |
| 176 | const int kCodeTargetTag = 1; |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 177 | const int kLocatableTag = 2; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 178 | const int kDefaultTag = 3; |
| 179 | |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 180 | const int kPCJumpExtraTag = (1 << kExtraTagBits) - 1; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 181 | |
| 182 | const int kSmallPCDeltaBits = kBitsPerByte - kTagBits; |
| 183 | const int kSmallPCDeltaMask = (1 << kSmallPCDeltaBits) - 1; |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 184 | const int RelocInfo::kMaxSmallPCDelta = kSmallPCDeltaMask; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 185 | |
| 186 | const int kVariableLengthPCJumpTopTag = 1; |
| 187 | const int kChunkBits = 7; |
| 188 | const int kChunkMask = (1 << kChunkBits) - 1; |
| 189 | const int kLastChunkTagBits = 1; |
| 190 | const int kLastChunkTagMask = 1; |
| 191 | const int kLastChunkTag = 1; |
| 192 | |
| 193 | |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 194 | const int kDataJumpExtraTag = kPCJumpExtraTag - 1; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 195 | |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 196 | const int kCodeWithIdTag = 0; |
| 197 | const int kNonstatementPositionTag = 1; |
| 198 | const int kStatementPositionTag = 2; |
| 199 | const int kCommentTag = 3; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 200 | |
| 201 | |
| 202 | uint32_t RelocInfoWriter::WriteVariableLengthPCJump(uint32_t pc_delta) { |
| 203 | // Return if the pc_delta can fit in kSmallPCDeltaBits bits. |
| 204 | // Otherwise write a variable length PC jump for the bits that do |
| 205 | // not fit in the kSmallPCDeltaBits bits. |
| 206 | if (is_uintn(pc_delta, kSmallPCDeltaBits)) return pc_delta; |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 207 | WriteExtraTag(kPCJumpExtraTag, kVariableLengthPCJumpTopTag); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 208 | uint32_t pc_jump = pc_delta >> kSmallPCDeltaBits; |
| 209 | ASSERT(pc_jump > 0); |
| 210 | // Write kChunkBits size chunks of the pc_jump. |
| 211 | for (; pc_jump > 0; pc_jump = pc_jump >> kChunkBits) { |
| 212 | byte b = pc_jump & kChunkMask; |
| 213 | *--pos_ = b << kLastChunkTagBits; |
| 214 | } |
| 215 | // Tag the last chunk so it can be identified. |
| 216 | *pos_ = *pos_ | kLastChunkTag; |
| 217 | // Return the remaining kSmallPCDeltaBits of the pc_delta. |
| 218 | return pc_delta & kSmallPCDeltaMask; |
| 219 | } |
| 220 | |
| 221 | |
| 222 | void RelocInfoWriter::WriteTaggedPC(uint32_t pc_delta, int tag) { |
| 223 | // Write a byte of tagged pc-delta, possibly preceded by var. length pc-jump. |
| 224 | pc_delta = WriteVariableLengthPCJump(pc_delta); |
| 225 | *--pos_ = pc_delta << kTagBits | tag; |
| 226 | } |
| 227 | |
| 228 | |
ager@chromium.org | e2902be | 2009-06-08 12:21:35 +0000 | [diff] [blame] | 229 | void RelocInfoWriter::WriteTaggedData(intptr_t data_delta, int tag) { |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 230 | *--pos_ = static_cast<byte>(data_delta << kLocatableTypeTagBits | tag); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 231 | } |
| 232 | |
| 233 | |
| 234 | void RelocInfoWriter::WriteExtraTag(int extra_tag, int top_tag) { |
ager@chromium.org | c4c9272 | 2009-11-18 14:12:51 +0000 | [diff] [blame] | 235 | *--pos_ = static_cast<int>(top_tag << (kTagBits + kExtraTagBits) | |
| 236 | extra_tag << kTagBits | |
| 237 | kDefaultTag); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 238 | } |
| 239 | |
| 240 | |
| 241 | void RelocInfoWriter::WriteExtraTaggedPC(uint32_t pc_delta, int extra_tag) { |
| 242 | // Write two-byte tagged pc-delta, possibly preceded by var. length pc-jump. |
| 243 | pc_delta = WriteVariableLengthPCJump(pc_delta); |
| 244 | WriteExtraTag(extra_tag, 0); |
| 245 | *--pos_ = pc_delta; |
| 246 | } |
| 247 | |
| 248 | |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 249 | void RelocInfoWriter::WriteExtraTaggedIntData(int data_delta, int top_tag) { |
| 250 | WriteExtraTag(kDataJumpExtraTag, top_tag); |
| 251 | for (int i = 0; i < kIntSize; i++) { |
| 252 | *--pos_ = static_cast<byte>(data_delta); |
| 253 | // Signed right shift is arithmetic shift. Tested in test-utils.cc. |
| 254 | data_delta = data_delta >> kBitsPerByte; |
| 255 | } |
| 256 | } |
| 257 | |
ager@chromium.org | e2902be | 2009-06-08 12:21:35 +0000 | [diff] [blame] | 258 | void RelocInfoWriter::WriteExtraTaggedData(intptr_t data_delta, int top_tag) { |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 259 | WriteExtraTag(kDataJumpExtraTag, top_tag); |
ager@chromium.org | e2902be | 2009-06-08 12:21:35 +0000 | [diff] [blame] | 260 | for (int i = 0; i < kIntptrSize; i++) { |
ager@chromium.org | c4c9272 | 2009-11-18 14:12:51 +0000 | [diff] [blame] | 261 | *--pos_ = static_cast<byte>(data_delta); |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 262 | // Signed right shift is arithmetic shift. Tested in test-utils.cc. |
ager@chromium.org | e2902be | 2009-06-08 12:21:35 +0000 | [diff] [blame] | 263 | data_delta = data_delta >> kBitsPerByte; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 264 | } |
| 265 | } |
| 266 | |
| 267 | |
| 268 | void RelocInfoWriter::Write(const RelocInfo* rinfo) { |
| 269 | #ifdef DEBUG |
| 270 | byte* begin_pos = pos_; |
| 271 | #endif |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 272 | ASSERT(rinfo->pc() - last_pc_ >= 0); |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 273 | ASSERT(RelocInfo::NUMBER_OF_MODES - RelocInfo::LAST_COMPACT_ENUM <= |
| 274 | kMaxRelocModes); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 275 | // Use unsigned delta-encoding for pc. |
ager@chromium.org | c4c9272 | 2009-11-18 14:12:51 +0000 | [diff] [blame] | 276 | uint32_t pc_delta = static_cast<uint32_t>(rinfo->pc() - last_pc_); |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 277 | RelocInfo::Mode rmode = rinfo->rmode(); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 278 | |
| 279 | // The two most common modes are given small tags, and usually fit in a byte. |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 280 | if (rmode == RelocInfo::EMBEDDED_OBJECT) { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 281 | WriteTaggedPC(pc_delta, kEmbeddedObjectTag); |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 282 | } else if (rmode == RelocInfo::CODE_TARGET) { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 283 | WriteTaggedPC(pc_delta, kCodeTargetTag); |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 284 | ASSERT(begin_pos - pos_ <= RelocInfo::kMaxCallSize); |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 285 | } else if (rmode == RelocInfo::CODE_TARGET_WITH_ID) { |
| 286 | // Use signed delta-encoding for id. |
| 287 | ASSERT(static_cast<int>(rinfo->data()) == rinfo->data()); |
| 288 | int id_delta = static_cast<int>(rinfo->data()) - last_id_; |
| 289 | // Check if delta is small enough to fit in a tagged byte. |
| 290 | if (is_intn(id_delta, kSmallDataBits)) { |
| 291 | WriteTaggedPC(pc_delta, kLocatableTag); |
| 292 | WriteTaggedData(id_delta, kCodeWithIdTag); |
danno@chromium.org | 160a7b0 | 2011-04-18 15:51:38 +0000 | [diff] [blame] | 293 | } else { |
| 294 | // Otherwise, use costly encoding. |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 295 | WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); |
| 296 | WriteExtraTaggedIntData(id_delta, kCodeWithIdTag); |
danno@chromium.org | 160a7b0 | 2011-04-18 15:51:38 +0000 | [diff] [blame] | 297 | } |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 298 | last_id_ = static_cast<int>(rinfo->data()); |
| 299 | } else if (RelocInfo::IsPosition(rmode)) { |
| 300 | // Use signed delta-encoding for position. |
| 301 | ASSERT(static_cast<int>(rinfo->data()) == rinfo->data()); |
| 302 | int pos_delta = static_cast<int>(rinfo->data()) - last_position_; |
| 303 | int pos_type_tag = (rmode == RelocInfo::POSITION) ? kNonstatementPositionTag |
| 304 | : kStatementPositionTag; |
| 305 | // Check if delta is small enough to fit in a tagged byte. |
| 306 | if (is_intn(pos_delta, kSmallDataBits)) { |
| 307 | WriteTaggedPC(pc_delta, kLocatableTag); |
| 308 | WriteTaggedData(pos_delta, pos_type_tag); |
| 309 | } else { |
| 310 | // Otherwise, use costly encoding. |
| 311 | WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); |
| 312 | WriteExtraTaggedIntData(pos_delta, pos_type_tag); |
| 313 | } |
| 314 | last_position_ = static_cast<int>(rinfo->data()); |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 315 | } else if (RelocInfo::IsComment(rmode)) { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 316 | // Comments are normally not generated, so we use the costly encoding. |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 317 | WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); |
| 318 | WriteExtraTaggedData(rinfo->data(), kCommentTag); |
ricow@chromium.org | 2233451 | 2011-02-25 07:28:50 +0000 | [diff] [blame] | 319 | ASSERT(begin_pos - pos_ >= RelocInfo::kMinRelocCommentSize); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 320 | } else { |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 321 | ASSERT(rmode > RelocInfo::LAST_COMPACT_ENUM); |
| 322 | int saved_mode = rmode - RelocInfo::LAST_COMPACT_ENUM; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 323 | // For all other modes we simply use the mode as the extra tag. |
| 324 | // None of these modes need a data component. |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 325 | ASSERT(saved_mode < kPCJumpExtraTag && saved_mode < kDataJumpExtraTag); |
| 326 | WriteExtraTaggedPC(pc_delta, saved_mode); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 327 | } |
| 328 | last_pc_ = rinfo->pc(); |
| 329 | #ifdef DEBUG |
| 330 | ASSERT(begin_pos - pos_ <= kMaxSize); |
| 331 | #endif |
| 332 | } |
| 333 | |
| 334 | |
| 335 | inline int RelocIterator::AdvanceGetTag() { |
| 336 | return *--pos_ & kTagMask; |
| 337 | } |
| 338 | |
| 339 | |
| 340 | inline int RelocIterator::GetExtraTag() { |
| 341 | return (*pos_ >> kTagBits) & ((1 << kExtraTagBits) - 1); |
| 342 | } |
| 343 | |
| 344 | |
| 345 | inline int RelocIterator::GetTopTag() { |
| 346 | return *pos_ >> (kTagBits + kExtraTagBits); |
| 347 | } |
| 348 | |
| 349 | |
| 350 | inline void RelocIterator::ReadTaggedPC() { |
| 351 | rinfo_.pc_ += *pos_ >> kTagBits; |
| 352 | } |
| 353 | |
| 354 | |
| 355 | inline void RelocIterator::AdvanceReadPC() { |
| 356 | rinfo_.pc_ += *--pos_; |
| 357 | } |
| 358 | |
| 359 | |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 360 | void RelocIterator::AdvanceReadId() { |
| 361 | int x = 0; |
| 362 | for (int i = 0; i < kIntSize; i++) { |
| 363 | x |= static_cast<int>(*--pos_) << i * kBitsPerByte; |
| 364 | } |
| 365 | last_id_ += x; |
| 366 | rinfo_.data_ = last_id_; |
| 367 | } |
| 368 | |
| 369 | |
| 370 | void RelocIterator::AdvanceReadPosition() { |
| 371 | int x = 0; |
| 372 | for (int i = 0; i < kIntSize; i++) { |
| 373 | x |= static_cast<int>(*--pos_) << i * kBitsPerByte; |
| 374 | } |
| 375 | last_position_ += x; |
| 376 | rinfo_.data_ = last_position_; |
| 377 | } |
| 378 | |
| 379 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 380 | void RelocIterator::AdvanceReadData() { |
ager@chromium.org | e2902be | 2009-06-08 12:21:35 +0000 | [diff] [blame] | 381 | intptr_t x = 0; |
| 382 | for (int i = 0; i < kIntptrSize; i++) { |
| 383 | x |= static_cast<intptr_t>(*--pos_) << i * kBitsPerByte; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 384 | } |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 385 | rinfo_.data_ = x; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 386 | } |
| 387 | |
| 388 | |
| 389 | void RelocIterator::AdvanceReadVariableLengthPCJump() { |
| 390 | // Read the 32-kSmallPCDeltaBits most significant bits of the |
| 391 | // pc jump in kChunkBits bit chunks and shift them into place. |
| 392 | // Stop when the last chunk is encountered. |
| 393 | uint32_t pc_jump = 0; |
| 394 | for (int i = 0; i < kIntSize; i++) { |
| 395 | byte pc_jump_part = *--pos_; |
| 396 | pc_jump |= (pc_jump_part >> kLastChunkTagBits) << i * kChunkBits; |
| 397 | if ((pc_jump_part & kLastChunkTagMask) == 1) break; |
| 398 | } |
| 399 | // The least significant kSmallPCDeltaBits bits will be added |
| 400 | // later. |
| 401 | rinfo_.pc_ += pc_jump << kSmallPCDeltaBits; |
| 402 | } |
| 403 | |
| 404 | |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 405 | inline int RelocIterator::GetLocatableTypeTag() { |
| 406 | return *pos_ & ((1 << kLocatableTypeTagBits) - 1); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 407 | } |
| 408 | |
| 409 | |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 410 | inline void RelocIterator::ReadTaggedId() { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 411 | int8_t signed_b = *pos_; |
ager@chromium.org | e2902be | 2009-06-08 12:21:35 +0000 | [diff] [blame] | 412 | // Signed right shift is arithmetic shift. Tested in test-utils.cc. |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 413 | last_id_ += signed_b >> kLocatableTypeTagBits; |
| 414 | rinfo_.data_ = last_id_; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 415 | } |
| 416 | |
| 417 | |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 418 | inline void RelocIterator::ReadTaggedPosition() { |
| 419 | int8_t signed_b = *pos_; |
| 420 | // Signed right shift is arithmetic shift. Tested in test-utils.cc. |
| 421 | last_position_ += signed_b >> kLocatableTypeTagBits; |
| 422 | rinfo_.data_ = last_position_; |
| 423 | } |
| 424 | |
| 425 | |
| 426 | static inline RelocInfo::Mode GetPositionModeFromTag(int tag) { |
| 427 | ASSERT(tag == kNonstatementPositionTag || |
| 428 | tag == kStatementPositionTag); |
| 429 | return (tag == kNonstatementPositionTag) ? |
| 430 | RelocInfo::POSITION : |
| 431 | RelocInfo::STATEMENT_POSITION; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 432 | } |
| 433 | |
| 434 | |
| 435 | void RelocIterator::next() { |
| 436 | ASSERT(!done()); |
| 437 | // Basically, do the opposite of RelocInfoWriter::Write. |
| 438 | // Reading of data is as far as possible avoided for unwanted modes, |
| 439 | // but we must always update the pc. |
| 440 | // |
| 441 | // We exit this loop by returning when we find a mode we want. |
| 442 | while (pos_ > end_) { |
| 443 | int tag = AdvanceGetTag(); |
| 444 | if (tag == kEmbeddedObjectTag) { |
| 445 | ReadTaggedPC(); |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 446 | if (SetMode(RelocInfo::EMBEDDED_OBJECT)) return; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 447 | } else if (tag == kCodeTargetTag) { |
| 448 | ReadTaggedPC(); |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 449 | if (SetMode(RelocInfo::CODE_TARGET)) return; |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 450 | } else if (tag == kLocatableTag) { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 451 | ReadTaggedPC(); |
| 452 | Advance(); |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 453 | int locatable_tag = GetLocatableTypeTag(); |
| 454 | if (locatable_tag == kCodeWithIdTag) { |
| 455 | if (SetMode(RelocInfo::CODE_TARGET_WITH_ID)) { |
| 456 | ReadTaggedId(); |
| 457 | return; |
| 458 | } |
| 459 | } else { |
| 460 | // Compact encoding is never used for comments, |
| 461 | // so it must be a position. |
| 462 | ASSERT(locatable_tag == kNonstatementPositionTag || |
| 463 | locatable_tag == kStatementPositionTag); |
| 464 | if (mode_mask_ & RelocInfo::kPositionMask) { |
| 465 | ReadTaggedPosition(); |
| 466 | if (SetMode(GetPositionModeFromTag(locatable_tag))) return; |
| 467 | } |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 468 | } |
| 469 | } else { |
| 470 | ASSERT(tag == kDefaultTag); |
| 471 | int extra_tag = GetExtraTag(); |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 472 | if (extra_tag == kPCJumpExtraTag) { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 473 | int top_tag = GetTopTag(); |
| 474 | if (top_tag == kVariableLengthPCJumpTopTag) { |
| 475 | AdvanceReadVariableLengthPCJump(); |
| 476 | } else { |
| 477 | AdvanceReadPC(); |
| 478 | } |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 479 | } else if (extra_tag == kDataJumpExtraTag) { |
| 480 | int locatable_tag = GetTopTag(); |
| 481 | if (locatable_tag == kCodeWithIdTag) { |
| 482 | if (SetMode(RelocInfo::CODE_TARGET_WITH_ID)) { |
| 483 | AdvanceReadId(); |
| 484 | return; |
| 485 | } |
| 486 | Advance(kIntSize); |
| 487 | } else if (locatable_tag != kCommentTag) { |
| 488 | ASSERT(locatable_tag == kNonstatementPositionTag || |
| 489 | locatable_tag == kStatementPositionTag); |
| 490 | if (mode_mask_ & RelocInfo::kPositionMask) { |
| 491 | AdvanceReadPosition(); |
| 492 | if (SetMode(GetPositionModeFromTag(locatable_tag))) return; |
| 493 | } else { |
| 494 | Advance(kIntSize); |
| 495 | } |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 496 | } else { |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 497 | ASSERT(locatable_tag == kCommentTag); |
| 498 | if (SetMode(RelocInfo::COMMENT)) { |
| 499 | AdvanceReadData(); |
| 500 | return; |
| 501 | } |
ager@chromium.org | eadaf22 | 2009-06-16 09:43:10 +0000 | [diff] [blame] | 502 | Advance(kIntptrSize); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 503 | } |
| 504 | } else { |
| 505 | AdvanceReadPC(); |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 506 | int rmode = extra_tag + RelocInfo::LAST_COMPACT_ENUM; |
| 507 | if (SetMode(static_cast<RelocInfo::Mode>(rmode))) return; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 508 | } |
| 509 | } |
| 510 | } |
| 511 | done_ = true; |
| 512 | } |
| 513 | |
| 514 | |
| 515 | RelocIterator::RelocIterator(Code* code, int mode_mask) { |
| 516 | rinfo_.pc_ = code->instruction_start(); |
| 517 | rinfo_.data_ = 0; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 518 | // Relocation info is read backwards. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 519 | pos_ = code->relocation_start() + code->relocation_size(); |
| 520 | end_ = code->relocation_start(); |
| 521 | done_ = false; |
| 522 | mode_mask_ = mode_mask; |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 523 | last_id_ = 0; |
| 524 | last_position_ = 0; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 525 | if (mode_mask_ == 0) pos_ = end_; |
| 526 | next(); |
| 527 | } |
| 528 | |
| 529 | |
| 530 | RelocIterator::RelocIterator(const CodeDesc& desc, int mode_mask) { |
| 531 | rinfo_.pc_ = desc.buffer; |
| 532 | rinfo_.data_ = 0; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 533 | // Relocation info is read backwards. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 534 | pos_ = desc.buffer + desc.buffer_size; |
| 535 | end_ = pos_ - desc.reloc_size; |
| 536 | done_ = false; |
| 537 | mode_mask_ = mode_mask; |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 538 | last_id_ = 0; |
| 539 | last_position_ = 0; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 540 | if (mode_mask_ == 0) pos_ = end_; |
| 541 | next(); |
| 542 | } |
| 543 | |
| 544 | |
| 545 | // ----------------------------------------------------------------------------- |
| 546 | // Implementation of RelocInfo |
| 547 | |
| 548 | |
mads.s.ager@gmail.com | 769cc96 | 2008-08-06 10:02:49 +0000 | [diff] [blame] | 549 | #ifdef ENABLE_DISASSEMBLER |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 550 | const char* RelocInfo::RelocModeName(RelocInfo::Mode rmode) { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 551 | switch (rmode) { |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 552 | case RelocInfo::NONE: |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 553 | return "no reloc"; |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 554 | case RelocInfo::EMBEDDED_OBJECT: |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 555 | return "embedded object"; |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 556 | case RelocInfo::CONSTRUCT_CALL: |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 557 | return "code target (js construct call)"; |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 558 | case RelocInfo::CODE_TARGET_CONTEXT: |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 559 | return "code target (context)"; |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 560 | case RelocInfo::DEBUG_BREAK: |
| 561 | #ifndef ENABLE_DEBUGGER_SUPPORT |
| 562 | UNREACHABLE(); |
| 563 | #endif |
| 564 | return "debug break"; |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 565 | case RelocInfo::CODE_TARGET: |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 566 | return "code target"; |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 567 | case RelocInfo::CODE_TARGET_WITH_ID: |
| 568 | return "code target with id"; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 569 | case RelocInfo::GLOBAL_PROPERTY_CELL: |
| 570 | return "global property cell"; |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 571 | case RelocInfo::RUNTIME_ENTRY: |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 572 | return "runtime entry"; |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 573 | case RelocInfo::JS_RETURN: |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 574 | return "js return"; |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 575 | case RelocInfo::COMMENT: |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 576 | return "comment"; |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 577 | case RelocInfo::POSITION: |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 578 | return "position"; |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 579 | case RelocInfo::STATEMENT_POSITION: |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 580 | return "statement position"; |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 581 | case RelocInfo::EXTERNAL_REFERENCE: |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 582 | return "external reference"; |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 583 | case RelocInfo::INTERNAL_REFERENCE: |
| 584 | return "internal reference"; |
vegorov@chromium.org | 2356e6f | 2010-06-09 09:38:56 +0000 | [diff] [blame] | 585 | case RelocInfo::DEBUG_BREAK_SLOT: |
| 586 | #ifndef ENABLE_DEBUGGER_SUPPORT |
| 587 | UNREACHABLE(); |
| 588 | #endif |
| 589 | return "debug break slot"; |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 590 | case RelocInfo::NUMBER_OF_MODES: |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 591 | UNREACHABLE(); |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 592 | return "number_of_modes"; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 593 | } |
| 594 | return "unknown relocation type"; |
| 595 | } |
| 596 | |
| 597 | |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 598 | void RelocInfo::Print(FILE* out) { |
| 599 | PrintF(out, "%p %s", pc_, RelocModeName(rmode_)); |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 600 | if (IsComment(rmode_)) { |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 601 | PrintF(out, " (%s)", reinterpret_cast<char*>(data_)); |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 602 | } else if (rmode_ == EMBEDDED_OBJECT) { |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 603 | PrintF(out, " ("); |
| 604 | target_object()->ShortPrint(out); |
| 605 | PrintF(out, ")"); |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 606 | } else if (rmode_ == EXTERNAL_REFERENCE) { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 607 | ExternalReferenceEncoder ref_encoder; |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 608 | PrintF(out, " (%s) (%p)", |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 609 | ref_encoder.NameOfAddress(*target_reference_address()), |
| 610 | *target_reference_address()); |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 611 | } else if (IsCodeTarget(rmode_)) { |
ager@chromium.org | 8bb6058 | 2008-12-11 12:02:20 +0000 | [diff] [blame] | 612 | Code* code = Code::GetCodeFromTargetAddress(target_address()); |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 613 | PrintF(out, " (%s) (%p)", Code::Kind2String(code->kind()), |
| 614 | target_address()); |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 615 | if (rmode_ == CODE_TARGET_WITH_ID) { |
| 616 | PrintF(" (id=%d)", static_cast<int>(data_)); |
| 617 | } |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 618 | } else if (IsPosition(rmode_)) { |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 619 | PrintF(out, " (%" V8_PTR_PREFIX "d)", data()); |
karlklose@chromium.org | 44bc708 | 2011-04-11 12:33:05 +0000 | [diff] [blame] | 620 | } else if (rmode_ == RelocInfo::RUNTIME_ENTRY && |
| 621 | Isolate::Current()->deoptimizer_data() != NULL) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 622 | // Depotimization bailouts are stored as runtime entries. |
| 623 | int id = Deoptimizer::GetDeoptimizationId( |
| 624 | target_address(), Deoptimizer::EAGER); |
| 625 | if (id != Deoptimizer::kNotDeoptimizationEntry) { |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 626 | PrintF(out, " (deoptimization bailout %d)", id); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 627 | } |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 628 | } |
| 629 | |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 630 | PrintF(out, "\n"); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 631 | } |
mads.s.ager | 31e7138 | 2008-08-13 09:32:07 +0000 | [diff] [blame] | 632 | #endif // ENABLE_DISASSEMBLER |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 633 | |
| 634 | |
mads.s.ager | 31e7138 | 2008-08-13 09:32:07 +0000 | [diff] [blame] | 635 | #ifdef DEBUG |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 636 | void RelocInfo::Verify() { |
| 637 | switch (rmode_) { |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 638 | case EMBEDDED_OBJECT: |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 639 | Object::VerifyPointer(target_object()); |
| 640 | break; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 641 | case GLOBAL_PROPERTY_CELL: |
| 642 | Object::VerifyPointer(target_cell()); |
| 643 | break; |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 644 | case DEBUG_BREAK: |
| 645 | #ifndef ENABLE_DEBUGGER_SUPPORT |
| 646 | UNREACHABLE(); |
| 647 | break; |
| 648 | #endif |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 649 | case CONSTRUCT_CALL: |
| 650 | case CODE_TARGET_CONTEXT: |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 651 | case CODE_TARGET_WITH_ID: |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 652 | case CODE_TARGET: { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 653 | // convert inline target address to code object |
| 654 | Address addr = target_address(); |
| 655 | ASSERT(addr != NULL); |
| 656 | // Check that we can find the right code object. |
ager@chromium.org | 4af710e | 2009-09-15 12:20:11 +0000 | [diff] [blame] | 657 | Code* code = Code::GetCodeFromTargetAddress(addr); |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 658 | Object* found = HEAP->FindCodeObject(addr); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 659 | ASSERT(found->IsCode()); |
| 660 | ASSERT(code->address() == HeapObject::cast(found)->address()); |
| 661 | break; |
| 662 | } |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 663 | case RUNTIME_ENTRY: |
| 664 | case JS_RETURN: |
| 665 | case COMMENT: |
| 666 | case POSITION: |
| 667 | case STATEMENT_POSITION: |
| 668 | case EXTERNAL_REFERENCE: |
| 669 | case INTERNAL_REFERENCE: |
vegorov@chromium.org | 2356e6f | 2010-06-09 09:38:56 +0000 | [diff] [blame] | 670 | case DEBUG_BREAK_SLOT: |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 671 | case NONE: |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 672 | break; |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 673 | case NUMBER_OF_MODES: |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 674 | UNREACHABLE(); |
| 675 | break; |
| 676 | } |
| 677 | } |
| 678 | #endif // DEBUG |
| 679 | |
| 680 | |
| 681 | // ----------------------------------------------------------------------------- |
| 682 | // Implementation of ExternalReference |
| 683 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 684 | ExternalReference::ExternalReference(Builtins::CFunctionId id, Isolate* isolate) |
| 685 | : address_(Redirect(isolate, Builtins::c_function_address(id))) {} |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 686 | |
| 687 | |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 688 | ExternalReference::ExternalReference( |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 689 | ApiFunction* fun, |
| 690 | Type type = ExternalReference::BUILTIN_CALL, |
| 691 | Isolate* isolate = NULL) |
| 692 | : address_(Redirect(isolate, fun->address(), type)) {} |
ager@chromium.org | c4c9272 | 2009-11-18 14:12:51 +0000 | [diff] [blame] | 693 | |
| 694 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 695 | ExternalReference::ExternalReference(Builtins::Name name, Isolate* isolate) |
| 696 | : address_(isolate->builtins()->builtin_address(name)) {} |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 697 | |
| 698 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 699 | ExternalReference::ExternalReference(Runtime::FunctionId id, |
| 700 | Isolate* isolate) |
| 701 | : address_(Redirect(isolate, Runtime::FunctionForId(id)->entry)) {} |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 702 | |
| 703 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 704 | ExternalReference::ExternalReference(const Runtime::Function* f, |
| 705 | Isolate* isolate) |
| 706 | : address_(Redirect(isolate, f->entry)) {} |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 707 | |
| 708 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 709 | ExternalReference ExternalReference::isolate_address() { |
| 710 | return ExternalReference(Isolate::Current()); |
| 711 | } |
| 712 | |
| 713 | |
| 714 | ExternalReference::ExternalReference(const IC_Utility& ic_utility, |
| 715 | Isolate* isolate) |
| 716 | : address_(Redirect(isolate, ic_utility.address())) {} |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 717 | |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 718 | #ifdef ENABLE_DEBUGGER_SUPPORT |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 719 | ExternalReference::ExternalReference(const Debug_Address& debug_address, |
| 720 | Isolate* isolate) |
| 721 | : address_(debug_address.address(isolate)) {} |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 722 | #endif |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 723 | |
| 724 | ExternalReference::ExternalReference(StatsCounter* counter) |
| 725 | : address_(reinterpret_cast<Address>(counter->GetInternalPointer())) {} |
| 726 | |
| 727 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 728 | ExternalReference::ExternalReference(Isolate::AddressId id, Isolate* isolate) |
| 729 | : address_(isolate->get_address_from_id(id)) {} |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 730 | |
| 731 | |
| 732 | ExternalReference::ExternalReference(const SCTableReference& table_ref) |
| 733 | : address_(table_ref.address()) {} |
| 734 | |
| 735 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 736 | ExternalReference ExternalReference::perform_gc_function(Isolate* isolate) { |
| 737 | return ExternalReference(Redirect(isolate, |
| 738 | FUNCTION_ADDR(Runtime::PerformGC))); |
ager@chromium.org | eadaf22 | 2009-06-16 09:43:10 +0000 | [diff] [blame] | 739 | } |
| 740 | |
| 741 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 742 | ExternalReference ExternalReference::fill_heap_number_with_random_function( |
| 743 | Isolate* isolate) { |
| 744 | return ExternalReference(Redirect( |
| 745 | isolate, |
| 746 | FUNCTION_ADDR(V8::FillHeapNumberWithRandom))); |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 747 | } |
| 748 | |
| 749 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 750 | ExternalReference ExternalReference::delete_handle_scope_extensions( |
| 751 | Isolate* isolate) { |
| 752 | return ExternalReference(Redirect( |
| 753 | isolate, |
| 754 | FUNCTION_ADDR(HandleScope::DeleteExtensions))); |
lrn@chromium.org | 303ada7 | 2010-10-27 09:33:13 +0000 | [diff] [blame] | 755 | } |
| 756 | |
| 757 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 758 | ExternalReference ExternalReference::random_uint32_function( |
| 759 | Isolate* isolate) { |
| 760 | return ExternalReference(Redirect(isolate, FUNCTION_ADDR(V8::Random))); |
ager@chromium.org | eadaf22 | 2009-06-16 09:43:10 +0000 | [diff] [blame] | 761 | } |
| 762 | |
| 763 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 764 | ExternalReference ExternalReference::transcendental_cache_array_address( |
| 765 | Isolate* isolate) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 766 | return ExternalReference( |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 767 | isolate->transcendental_cache()->cache_array_address()); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 768 | } |
| 769 | |
| 770 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 771 | ExternalReference ExternalReference::new_deoptimizer_function( |
| 772 | Isolate* isolate) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 773 | return ExternalReference( |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 774 | Redirect(isolate, FUNCTION_ADDR(Deoptimizer::New))); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 775 | } |
| 776 | |
| 777 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 778 | ExternalReference ExternalReference::compute_output_frames_function( |
| 779 | Isolate* isolate) { |
| 780 | return ExternalReference( |
| 781 | Redirect(isolate, FUNCTION_ADDR(Deoptimizer::ComputeOutputFrames))); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 782 | } |
| 783 | |
| 784 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 785 | ExternalReference ExternalReference::global_contexts_list(Isolate* isolate) { |
| 786 | return ExternalReference(isolate->heap()->global_contexts_list_address()); |
kmillikin@chromium.org | 13bd294 | 2009-12-16 15:36:05 +0000 | [diff] [blame] | 787 | } |
| 788 | |
| 789 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 790 | ExternalReference ExternalReference::keyed_lookup_cache_keys(Isolate* isolate) { |
| 791 | return ExternalReference(isolate->keyed_lookup_cache()->keys_address()); |
kmillikin@chromium.org | 13bd294 | 2009-12-16 15:36:05 +0000 | [diff] [blame] | 792 | } |
| 793 | |
| 794 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 795 | ExternalReference ExternalReference::keyed_lookup_cache_field_offsets( |
| 796 | Isolate* isolate) { |
| 797 | return ExternalReference( |
| 798 | isolate->keyed_lookup_cache()->field_offsets_address()); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 799 | } |
| 800 | |
| 801 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 802 | ExternalReference ExternalReference::the_hole_value_location(Isolate* isolate) { |
| 803 | return ExternalReference(isolate->factory()->the_hole_value().location()); |
kmillikin@chromium.org | d2c22f0 | 2011-01-10 08:15:37 +0000 | [diff] [blame] | 804 | } |
| 805 | |
| 806 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 807 | ExternalReference ExternalReference::arguments_marker_location( |
| 808 | Isolate* isolate) { |
| 809 | return ExternalReference(isolate->factory()->arguments_marker().location()); |
ager@chromium.org | ab99eea | 2009-08-25 07:05:41 +0000 | [diff] [blame] | 810 | } |
| 811 | |
| 812 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 813 | ExternalReference ExternalReference::roots_address(Isolate* isolate) { |
| 814 | return ExternalReference(isolate->heap()->roots_address()); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 815 | } |
| 816 | |
| 817 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 818 | ExternalReference ExternalReference::address_of_stack_limit(Isolate* isolate) { |
| 819 | return ExternalReference(isolate->stack_guard()->address_of_jslimit()); |
ager@chromium.org | c4c9272 | 2009-11-18 14:12:51 +0000 | [diff] [blame] | 820 | } |
| 821 | |
| 822 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 823 | ExternalReference ExternalReference::address_of_real_stack_limit( |
| 824 | Isolate* isolate) { |
| 825 | return ExternalReference(isolate->stack_guard()->address_of_real_jslimit()); |
ager@chromium.org | 3291210 | 2009-01-16 10:38:43 +0000 | [diff] [blame] | 826 | } |
| 827 | |
| 828 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 829 | ExternalReference ExternalReference::address_of_regexp_stack_limit( |
| 830 | Isolate* isolate) { |
| 831 | return ExternalReference(isolate->regexp_stack()->limit_address()); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 832 | } |
| 833 | |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 834 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 835 | ExternalReference ExternalReference::new_space_start(Isolate* isolate) { |
| 836 | return ExternalReference(isolate->heap()->NewSpaceStart()); |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 837 | } |
| 838 | |
| 839 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 840 | ExternalReference ExternalReference::new_space_mask(Isolate* isolate) { |
| 841 | Address mask = reinterpret_cast<Address>(isolate->heap()->NewSpaceMask()); |
| 842 | return ExternalReference(mask); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 843 | } |
| 844 | |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 845 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 846 | ExternalReference ExternalReference::new_space_allocation_top_address( |
| 847 | Isolate* isolate) { |
| 848 | return ExternalReference(isolate->heap()->NewSpaceAllocationTopAddress()); |
kasperl@chromium.org | 9bbf968 | 2008-10-30 11:53:07 +0000 | [diff] [blame] | 849 | } |
| 850 | |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 851 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 852 | ExternalReference ExternalReference::heap_always_allocate_scope_depth( |
| 853 | Isolate* isolate) { |
| 854 | Heap* heap = isolate->heap(); |
| 855 | return ExternalReference(heap->always_allocate_scope_depth_address()); |
| 856 | } |
| 857 | |
| 858 | |
| 859 | ExternalReference ExternalReference::new_space_allocation_limit_address( |
| 860 | Isolate* isolate) { |
| 861 | return ExternalReference(isolate->heap()->NewSpaceAllocationLimitAddress()); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 862 | } |
| 863 | |
ager@chromium.org | c4c9272 | 2009-11-18 14:12:51 +0000 | [diff] [blame] | 864 | |
lrn@chromium.org | 303ada7 | 2010-10-27 09:33:13 +0000 | [diff] [blame] | 865 | ExternalReference ExternalReference::handle_scope_level_address() { |
| 866 | return ExternalReference(HandleScope::current_level_address()); |
ager@chromium.org | c4c9272 | 2009-11-18 14:12:51 +0000 | [diff] [blame] | 867 | } |
| 868 | |
| 869 | |
| 870 | ExternalReference ExternalReference::handle_scope_next_address() { |
| 871 | return ExternalReference(HandleScope::current_next_address()); |
| 872 | } |
| 873 | |
| 874 | |
| 875 | ExternalReference ExternalReference::handle_scope_limit_address() { |
| 876 | return ExternalReference(HandleScope::current_limit_address()); |
| 877 | } |
| 878 | |
| 879 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 880 | ExternalReference ExternalReference::scheduled_exception_address( |
| 881 | Isolate* isolate) { |
| 882 | return ExternalReference(isolate->scheduled_exception_address()); |
ager@chromium.org | c4c9272 | 2009-11-18 14:12:51 +0000 | [diff] [blame] | 883 | } |
| 884 | |
| 885 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 886 | ExternalReference ExternalReference::address_of_min_int() { |
| 887 | return ExternalReference(reinterpret_cast<void*>( |
| 888 | const_cast<double*>(&DoubleConstant::min_int))); |
| 889 | } |
| 890 | |
| 891 | |
| 892 | ExternalReference ExternalReference::address_of_one_half() { |
| 893 | return ExternalReference(reinterpret_cast<void*>( |
| 894 | const_cast<double*>(&DoubleConstant::one_half))); |
| 895 | } |
| 896 | |
| 897 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 898 | ExternalReference ExternalReference::address_of_minus_zero() { |
| 899 | return ExternalReference(reinterpret_cast<void*>( |
| 900 | const_cast<double*>(&DoubleConstant::minus_zero))); |
| 901 | } |
| 902 | |
| 903 | |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 904 | ExternalReference ExternalReference::address_of_negative_infinity() { |
| 905 | return ExternalReference(reinterpret_cast<void*>( |
| 906 | const_cast<double*>(&DoubleConstant::negative_infinity))); |
| 907 | } |
| 908 | |
| 909 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 910 | ExternalReference ExternalReference::address_of_nan() { |
| 911 | return ExternalReference(reinterpret_cast<void*>( |
| 912 | const_cast<double*>(&DoubleConstant::nan))); |
| 913 | } |
| 914 | |
| 915 | |
ricow@chromium.org | c9c8082 | 2010-04-21 08:22:37 +0000 | [diff] [blame] | 916 | #ifndef V8_INTERPRETED_REGEXP |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 917 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 918 | ExternalReference ExternalReference::re_check_stack_guard_state( |
| 919 | Isolate* isolate) { |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 920 | Address function; |
| 921 | #ifdef V8_TARGET_ARCH_X64 |
| 922 | function = FUNCTION_ADDR(RegExpMacroAssemblerX64::CheckStackGuardState); |
| 923 | #elif V8_TARGET_ARCH_IA32 |
| 924 | function = FUNCTION_ADDR(RegExpMacroAssemblerIA32::CheckStackGuardState); |
| 925 | #elif V8_TARGET_ARCH_ARM |
| 926 | function = FUNCTION_ADDR(RegExpMacroAssemblerARM::CheckStackGuardState); |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 927 | #elif V8_TARGET_ARCH_MIPS |
| 928 | function = FUNCTION_ADDR(RegExpMacroAssemblerMIPS::CheckStackGuardState); |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 929 | #else |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 930 | UNREACHABLE(); |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 931 | #endif |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 932 | return ExternalReference(Redirect(isolate, function)); |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 933 | } |
| 934 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 935 | ExternalReference ExternalReference::re_grow_stack(Isolate* isolate) { |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 936 | return ExternalReference( |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 937 | Redirect(isolate, FUNCTION_ADDR(NativeRegExpMacroAssembler::GrowStack))); |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 938 | } |
| 939 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 940 | ExternalReference ExternalReference::re_case_insensitive_compare_uc16( |
| 941 | Isolate* isolate) { |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 942 | return ExternalReference(Redirect( |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 943 | isolate, |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 944 | FUNCTION_ADDR(NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16))); |
| 945 | } |
| 946 | |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 947 | ExternalReference ExternalReference::re_word_character_map() { |
| 948 | return ExternalReference( |
| 949 | NativeRegExpMacroAssembler::word_character_map_address()); |
| 950 | } |
fschneider@chromium.org | 0c20e67 | 2010-01-14 15:28:53 +0000 | [diff] [blame] | 951 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 952 | ExternalReference ExternalReference::address_of_static_offsets_vector( |
| 953 | Isolate* isolate) { |
| 954 | return ExternalReference( |
| 955 | OffsetsVector::static_offsets_vector_address(isolate)); |
fschneider@chromium.org | 0c20e67 | 2010-01-14 15:28:53 +0000 | [diff] [blame] | 956 | } |
| 957 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 958 | ExternalReference ExternalReference::address_of_regexp_stack_memory_address( |
| 959 | Isolate* isolate) { |
| 960 | return ExternalReference( |
| 961 | isolate->regexp_stack()->memory_address()); |
fschneider@chromium.org | 0c20e67 | 2010-01-14 15:28:53 +0000 | [diff] [blame] | 962 | } |
| 963 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 964 | ExternalReference ExternalReference::address_of_regexp_stack_memory_size( |
| 965 | Isolate* isolate) { |
| 966 | return ExternalReference(isolate->regexp_stack()->memory_size_address()); |
fschneider@chromium.org | 0c20e67 | 2010-01-14 15:28:53 +0000 | [diff] [blame] | 967 | } |
| 968 | |
ricow@chromium.org | c9c8082 | 2010-04-21 08:22:37 +0000 | [diff] [blame] | 969 | #endif // V8_INTERPRETED_REGEXP |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 970 | |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 971 | |
| 972 | static double add_two_doubles(double x, double y) { |
| 973 | return x + y; |
| 974 | } |
| 975 | |
| 976 | |
| 977 | static double sub_two_doubles(double x, double y) { |
| 978 | return x - y; |
| 979 | } |
| 980 | |
| 981 | |
| 982 | static double mul_two_doubles(double x, double y) { |
| 983 | return x * y; |
| 984 | } |
| 985 | |
| 986 | |
kasperl@chromium.org | 86f77b7 | 2009-07-06 08:21:57 +0000 | [diff] [blame] | 987 | static double div_two_doubles(double x, double y) { |
| 988 | return x / y; |
| 989 | } |
| 990 | |
| 991 | |
| 992 | static double mod_two_doubles(double x, double y) { |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 993 | return modulo(x, y); |
kasperl@chromium.org | 86f77b7 | 2009-07-06 08:21:57 +0000 | [diff] [blame] | 994 | } |
| 995 | |
| 996 | |
karlklose@chromium.org | 8f806e8 | 2011-03-07 14:06:08 +0000 | [diff] [blame] | 997 | static double math_sin_double(double x) { |
| 998 | return sin(x); |
| 999 | } |
| 1000 | |
| 1001 | |
| 1002 | static double math_cos_double(double x) { |
| 1003 | return cos(x); |
| 1004 | } |
| 1005 | |
| 1006 | |
| 1007 | static double math_log_double(double x) { |
| 1008 | return log(x); |
| 1009 | } |
| 1010 | |
| 1011 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 1012 | ExternalReference ExternalReference::math_sin_double_function( |
| 1013 | Isolate* isolate) { |
| 1014 | return ExternalReference(Redirect(isolate, |
| 1015 | FUNCTION_ADDR(math_sin_double), |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 1016 | BUILTIN_FP_CALL)); |
karlklose@chromium.org | 8f806e8 | 2011-03-07 14:06:08 +0000 | [diff] [blame] | 1017 | } |
| 1018 | |
| 1019 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 1020 | ExternalReference ExternalReference::math_cos_double_function( |
| 1021 | Isolate* isolate) { |
| 1022 | return ExternalReference(Redirect(isolate, |
| 1023 | FUNCTION_ADDR(math_cos_double), |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 1024 | BUILTIN_FP_CALL)); |
karlklose@chromium.org | 8f806e8 | 2011-03-07 14:06:08 +0000 | [diff] [blame] | 1025 | } |
| 1026 | |
| 1027 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 1028 | ExternalReference ExternalReference::math_log_double_function( |
| 1029 | Isolate* isolate) { |
| 1030 | return ExternalReference(Redirect(isolate, |
| 1031 | FUNCTION_ADDR(math_log_double), |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 1032 | BUILTIN_FP_CALL)); |
karlklose@chromium.org | 8f806e8 | 2011-03-07 14:06:08 +0000 | [diff] [blame] | 1033 | } |
| 1034 | |
| 1035 | |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 1036 | // Helper function to compute x^y, where y is known to be an |
| 1037 | // integer. Uses binary decomposition to limit the number of |
| 1038 | // multiplications; see the discussion in "Hacker's Delight" by Henry |
| 1039 | // S. Warren, Jr., figure 11-6, page 213. |
| 1040 | double power_double_int(double x, int y) { |
| 1041 | double m = (y < 0) ? 1 / x : x; |
| 1042 | unsigned n = (y < 0) ? -y : y; |
| 1043 | double p = 1; |
| 1044 | while (n != 0) { |
| 1045 | if ((n & 1) != 0) p *= m; |
| 1046 | m *= m; |
| 1047 | if ((n & 2) != 0) p *= m; |
| 1048 | m *= m; |
| 1049 | n >>= 2; |
| 1050 | } |
| 1051 | return p; |
| 1052 | } |
| 1053 | |
| 1054 | |
| 1055 | double power_double_double(double x, double y) { |
| 1056 | int y_int = static_cast<int>(y); |
| 1057 | if (y == y_int) { |
| 1058 | return power_double_int(x, y_int); // Returns 1.0 for exponent 0. |
| 1059 | } |
| 1060 | if (!isinf(x)) { |
kmillikin@chromium.org | 31b1277 | 2011-02-02 16:08:26 +0000 | [diff] [blame] | 1061 | if (y == 0.5) return sqrt(x + 0.0); // -0 must be converted to +0. |
| 1062 | if (y == -0.5) return 1.0 / sqrt(x + 0.0); |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 1063 | } |
| 1064 | if (isnan(y) || ((x == 1 || x == -1) && isinf(y))) { |
| 1065 | return OS::nan_value(); |
| 1066 | } |
| 1067 | return pow(x, y); |
| 1068 | } |
| 1069 | |
| 1070 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 1071 | ExternalReference ExternalReference::power_double_double_function( |
| 1072 | Isolate* isolate) { |
| 1073 | return ExternalReference(Redirect(isolate, |
| 1074 | FUNCTION_ADDR(power_double_double), |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 1075 | BUILTIN_FP_FP_CALL)); |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 1076 | } |
| 1077 | |
| 1078 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 1079 | ExternalReference ExternalReference::power_double_int_function( |
| 1080 | Isolate* isolate) { |
| 1081 | return ExternalReference(Redirect(isolate, |
| 1082 | FUNCTION_ADDR(power_double_int), |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 1083 | BUILTIN_FP_INT_CALL)); |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 1084 | } |
| 1085 | |
| 1086 | |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 1087 | static int native_compare_doubles(double y, double x) { |
| 1088 | if (x == y) return EQUAL; |
| 1089 | return x < y ? LESS : GREATER; |
kasperl@chromium.org | 2abc450 | 2009-07-02 07:00:29 +0000 | [diff] [blame] | 1090 | } |
| 1091 | |
| 1092 | |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 1093 | ExternalReference ExternalReference::double_fp_operation( |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 1094 | Token::Value operation, Isolate* isolate) { |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 1095 | typedef double BinaryFPOperation(double x, double y); |
| 1096 | BinaryFPOperation* function = NULL; |
| 1097 | switch (operation) { |
| 1098 | case Token::ADD: |
| 1099 | function = &add_two_doubles; |
| 1100 | break; |
| 1101 | case Token::SUB: |
| 1102 | function = &sub_two_doubles; |
| 1103 | break; |
| 1104 | case Token::MUL: |
| 1105 | function = &mul_two_doubles; |
| 1106 | break; |
kasperl@chromium.org | 86f77b7 | 2009-07-06 08:21:57 +0000 | [diff] [blame] | 1107 | case Token::DIV: |
| 1108 | function = &div_two_doubles; |
| 1109 | break; |
| 1110 | case Token::MOD: |
| 1111 | function = &mod_two_doubles; |
| 1112 | break; |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 1113 | default: |
| 1114 | UNREACHABLE(); |
| 1115 | } |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 1116 | return ExternalReference(Redirect(isolate, |
| 1117 | FUNCTION_ADDR(function), |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 1118 | BUILTIN_FP_FP_CALL)); |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 1119 | } |
| 1120 | |
| 1121 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 1122 | ExternalReference ExternalReference::compare_doubles(Isolate* isolate) { |
| 1123 | return ExternalReference(Redirect(isolate, |
| 1124 | FUNCTION_ADDR(native_compare_doubles), |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 1125 | BUILTIN_COMPARE_CALL)); |
kasperl@chromium.org | 2abc450 | 2009-07-02 07:00:29 +0000 | [diff] [blame] | 1126 | } |
| 1127 | |
| 1128 | |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 1129 | #ifdef ENABLE_DEBUGGER_SUPPORT |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 1130 | ExternalReference ExternalReference::debug_break(Isolate* isolate) { |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 1131 | return ExternalReference(Redirect(isolate, FUNCTION_ADDR(Debug_Break))); |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 1132 | } |
| 1133 | |
| 1134 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 1135 | ExternalReference ExternalReference::debug_step_in_fp_address( |
| 1136 | Isolate* isolate) { |
| 1137 | return ExternalReference(isolate->debug()->step_in_fp_addr()); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 1138 | } |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 1139 | #endif |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 1140 | |
whesse@chromium.org | f0ac72d | 2010-11-08 12:47:26 +0000 | [diff] [blame] | 1141 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1142 | void PositionsRecorder::RecordPosition(int pos) { |
whesse@chromium.org | f0ac72d | 2010-11-08 12:47:26 +0000 | [diff] [blame] | 1143 | ASSERT(pos != RelocInfo::kNoPosition); |
| 1144 | ASSERT(pos >= 0); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1145 | state_.current_position = pos; |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1146 | #ifdef ENABLE_GDB_JIT_INTERFACE |
| 1147 | if (gdbjit_lineinfo_ != NULL) { |
| 1148 | gdbjit_lineinfo_->SetPosition(assembler_->pc_offset(), pos, false); |
| 1149 | } |
| 1150 | #endif |
whesse@chromium.org | f0ac72d | 2010-11-08 12:47:26 +0000 | [diff] [blame] | 1151 | } |
| 1152 | |
| 1153 | |
| 1154 | void PositionsRecorder::RecordStatementPosition(int pos) { |
| 1155 | ASSERT(pos != RelocInfo::kNoPosition); |
| 1156 | ASSERT(pos >= 0); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1157 | state_.current_statement_position = pos; |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 1158 | #ifdef ENABLE_GDB_JIT_INTERFACE |
| 1159 | if (gdbjit_lineinfo_ != NULL) { |
| 1160 | gdbjit_lineinfo_->SetPosition(assembler_->pc_offset(), pos, true); |
| 1161 | } |
| 1162 | #endif |
whesse@chromium.org | f0ac72d | 2010-11-08 12:47:26 +0000 | [diff] [blame] | 1163 | } |
| 1164 | |
| 1165 | |
| 1166 | bool PositionsRecorder::WriteRecordedPositions() { |
| 1167 | bool written = false; |
| 1168 | |
| 1169 | // Write the statement position if it is different from what was written last |
| 1170 | // time. |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1171 | if (state_.current_statement_position != state_.written_statement_position) { |
whesse@chromium.org | f0ac72d | 2010-11-08 12:47:26 +0000 | [diff] [blame] | 1172 | EnsureSpace ensure_space(assembler_); |
| 1173 | assembler_->RecordRelocInfo(RelocInfo::STATEMENT_POSITION, |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1174 | state_.current_statement_position); |
| 1175 | state_.written_statement_position = state_.current_statement_position; |
whesse@chromium.org | f0ac72d | 2010-11-08 12:47:26 +0000 | [diff] [blame] | 1176 | written = true; |
| 1177 | } |
| 1178 | |
| 1179 | // Write the position if it is different from what was written last time and |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1180 | // also different from the written statement position. |
| 1181 | if (state_.current_position != state_.written_position && |
| 1182 | state_.current_position != state_.written_statement_position) { |
whesse@chromium.org | f0ac72d | 2010-11-08 12:47:26 +0000 | [diff] [blame] | 1183 | EnsureSpace ensure_space(assembler_); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1184 | assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); |
| 1185 | state_.written_position = state_.current_position; |
whesse@chromium.org | f0ac72d | 2010-11-08 12:47:26 +0000 | [diff] [blame] | 1186 | written = true; |
| 1187 | } |
| 1188 | |
whesse@chromium.org | f0ac72d | 2010-11-08 12:47:26 +0000 | [diff] [blame] | 1189 | // Return whether something was written. |
| 1190 | return written; |
| 1191 | } |
| 1192 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 1193 | } } // namespace v8::internal |