Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: src/safepoint-table.cc

Issue 10701054: Enable stub generation using Hydrogen/Lithium (again) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merge with latest Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/runtime.cc ('k') | src/serialize.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 bool SafepointEntry::HasRegisterAt(int reg_index) const { 52 bool SafepointEntry::HasRegisterAt(int reg_index) const {
53 ASSERT(is_valid()); 53 ASSERT(is_valid());
54 ASSERT(reg_index >= 0 && reg_index < kNumSafepointRegisters); 54 ASSERT(reg_index >= 0 && reg_index < kNumSafepointRegisters);
55 int byte_index = reg_index >> kBitsPerByteLog2; 55 int byte_index = reg_index >> kBitsPerByteLog2;
56 int bit_index = reg_index & (kBitsPerByte - 1); 56 int bit_index = reg_index & (kBitsPerByte - 1);
57 return (bits_[byte_index] & (1 << bit_index)) != 0; 57 return (bits_[byte_index] & (1 << bit_index)) != 0;
58 } 58 }
59 59
60 60
61 SafepointTable::SafepointTable(Code* code) { 61 SafepointTable::SafepointTable(Code* code) {
62 ASSERT(code->kind() == Code::OPTIMIZED_FUNCTION); 62 ASSERT(code->kind() == Code::OPTIMIZED_FUNCTION ||
63 code->kind() == Code::COMPILED_STUB);
63 code_ = code; 64 code_ = code;
64 Address header = code->instruction_start() + code->safepoint_table_offset(); 65 Address header = code->instruction_start() + code->safepoint_table_offset();
65 length_ = Memory::uint32_at(header + kLengthOffset); 66 length_ = Memory::uint32_at(header + kLengthOffset);
66 entry_size_ = Memory::uint32_at(header + kEntrySizeOffset); 67 entry_size_ = Memory::uint32_at(header + kEntrySizeOffset);
67 pc_and_deoptimization_indexes_ = header + kHeaderSize; 68 pc_and_deoptimization_indexes_ = header + kHeaderSize;
68 entries_ = pc_and_deoptimization_indexes_ + 69 entries_ = pc_and_deoptimization_indexes_ +
69 (length_ * kPcAndDeoptimizationIndexSize); 70 (length_ * kPcAndDeoptimizationIndexSize);
70 ASSERT(entry_size_ > 0); 71 ASSERT(entry_size_ > 0);
71 STATIC_ASSERT(SafepointEntry::DeoptimizationIndexField::kMax == 72 STATIC_ASSERT(SafepointEntry::DeoptimizationIndexField::kMax ==
72 Safepoint::kNoDeoptimizationIndex); 73 Safepoint::kNoDeoptimizationIndex);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 } 152 }
152 } 153 }
153 154
154 unsigned SafepointTableBuilder::GetCodeOffset() const { 155 unsigned SafepointTableBuilder::GetCodeOffset() const {
155 ASSERT(emitted_); 156 ASSERT(emitted_);
156 return offset_; 157 return offset_;
157 } 158 }
158 159
159 160
160 void SafepointTableBuilder::Emit(Assembler* assembler, int bits_per_entry) { 161 void SafepointTableBuilder::Emit(Assembler* assembler, int bits_per_entry) {
161 // For lazy deoptimization we need space to patch a call after every call.
162 // Ensure there is always space for such patching, even if the code ends
163 // in a call.
164 int target_offset = assembler->pc_offset() + Deoptimizer::patch_size();
165 while (assembler->pc_offset() < target_offset) {
166 assembler->nop();
167 }
168
169 // Make sure the safepoint table is properly aligned. Pad with nops. 162 // Make sure the safepoint table is properly aligned. Pad with nops.
170 assembler->Align(kIntSize); 163 assembler->Align(kIntSize);
171 assembler->RecordComment(";;; Safepoint table."); 164 assembler->RecordComment(";;; Safepoint table.");
172 offset_ = assembler->pc_offset(); 165 offset_ = assembler->pc_offset();
173 166
174 // Take the register bits into account. 167 // Take the register bits into account.
175 bits_per_entry += kNumSafepointRegisters; 168 bits_per_entry += kNumSafepointRegisters;
176 169
177 // Compute the number of bytes per safepoint entry. 170 // Compute the number of bytes per safepoint entry.
178 int bytes_per_entry = 171 int bytes_per_entry =
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 unsigned index) { 229 unsigned index) {
237 uint32_t encoding = SafepointEntry::DeoptimizationIndexField::encode(index); 230 uint32_t encoding = SafepointEntry::DeoptimizationIndexField::encode(index);
238 encoding |= SafepointEntry::ArgumentsField::encode(info.arguments); 231 encoding |= SafepointEntry::ArgumentsField::encode(info.arguments);
239 encoding |= SafepointEntry::SaveDoublesField::encode(info.has_doubles); 232 encoding |= SafepointEntry::SaveDoublesField::encode(info.has_doubles);
240 return encoding; 233 return encoding;
241 } 234 }
242 235
243 236
244 237
245 } } // namespace v8::internal 238 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | src/serialize.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698