OLD | NEW |
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 : isolate_(isolate), | 127 : isolate_(isolate), |
128 jit_cookie_(0), | 128 jit_cookie_(0), |
129 enabled_cpu_features_(0), | 129 enabled_cpu_features_(0), |
130 emit_debug_code_(FLAG_debug_code), | 130 emit_debug_code_(FLAG_debug_code), |
131 predictable_code_size_(false), | 131 predictable_code_size_(false), |
132 // We may use the assembler without an isolate. | 132 // We may use the assembler without an isolate. |
133 serializer_enabled_(isolate && isolate->serializer_enabled()) { | 133 serializer_enabled_(isolate && isolate->serializer_enabled()) { |
134 if (FLAG_mask_constants_with_cookie && isolate != NULL) { | 134 if (FLAG_mask_constants_with_cookie && isolate != NULL) { |
135 jit_cookie_ = isolate->random_number_generator()->NextInt(); | 135 jit_cookie_ = isolate->random_number_generator()->NextInt(); |
136 } | 136 } |
137 if (buffer == NULL) { | 137 own_buffer_ = buffer == NULL; |
138 // Do our own buffer management. | 138 if (buffer_size == 0) buffer_size = kMinimalBufferSize; |
139 buffer = NewArray<byte>(buffer_size); | 139 DCHECK(buffer_size > 0); |
140 own_buffer_ = true; | 140 if (own_buffer_) buffer = NewArray<byte>(buffer_size); |
141 } else { | |
142 // Use externally provided buffer instead. | |
143 DCHECK(buffer_size > 0); | |
144 own_buffer_ = false; | |
145 } | |
146 buffer_ = static_cast<byte*>(buffer); | 141 buffer_ = static_cast<byte*>(buffer); |
147 buffer_size_ = buffer_size; | 142 buffer_size_ = buffer_size; |
148 | 143 |
149 pc_ = buffer_; | 144 pc_ = buffer_; |
150 } | 145 } |
151 | 146 |
152 | 147 |
153 AssemblerBase::~AssemblerBase() { | 148 AssemblerBase::~AssemblerBase() { |
154 if (own_buffer_) DeleteArray(buffer_); | 149 if (own_buffer_) DeleteArray(buffer_); |
155 } | 150 } |
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1601 r2 = r2 - ad; | 1596 r2 = r2 - ad; |
1602 } | 1597 } |
1603 delta = ad - r2; | 1598 delta = ad - r2; |
1604 } while (q1 < delta || (q1 == delta && r1 == 0)); | 1599 } while (q1 < delta || (q1 == delta && r1 == 0)); |
1605 int32_t mul = static_cast<int32_t>(q2 + 1); | 1600 int32_t mul = static_cast<int32_t>(q2 + 1); |
1606 multiplier_ = (d < 0) ? -mul : mul; | 1601 multiplier_ = (d < 0) ? -mul : mul; |
1607 shift_ = p - 32; | 1602 shift_ = p - 32; |
1608 } | 1603 } |
1609 | 1604 |
1610 } } // namespace v8::internal | 1605 } } // namespace v8::internal |
OLD | NEW |