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

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

Issue 11498006: Revert 13157, 13145 and 13140: Crankshaft code stubs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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);
64 code_ = code; 63 code_ = code;
65 Address header = code->instruction_start() + code->safepoint_table_offset(); 64 Address header = code->instruction_start() + code->safepoint_table_offset();
66 length_ = Memory::uint32_at(header + kLengthOffset); 65 length_ = Memory::uint32_at(header + kLengthOffset);
67 entry_size_ = Memory::uint32_at(header + kEntrySizeOffset); 66 entry_size_ = Memory::uint32_at(header + kEntrySizeOffset);
68 pc_and_deoptimization_indexes_ = header + kHeaderSize; 67 pc_and_deoptimization_indexes_ = header + kHeaderSize;
69 entries_ = pc_and_deoptimization_indexes_ + 68 entries_ = pc_and_deoptimization_indexes_ +
70 (length_ * kPcAndDeoptimizationIndexSize); 69 (length_ * kPcAndDeoptimizationIndexSize);
71 ASSERT(entry_size_ > 0); 70 ASSERT(entry_size_ > 0);
72 STATIC_ASSERT(SafepointEntry::DeoptimizationIndexField::kMax == 71 STATIC_ASSERT(SafepointEntry::DeoptimizationIndexField::kMax ==
73 Safepoint::kNoDeoptimizationIndex); 72 Safepoint::kNoDeoptimizationIndex);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 } 151 }
153 } 152 }
154 153
155 unsigned SafepointTableBuilder::GetCodeOffset() const { 154 unsigned SafepointTableBuilder::GetCodeOffset() const {
156 ASSERT(emitted_); 155 ASSERT(emitted_);
157 return offset_; 156 return offset_;
158 } 157 }
159 158
160 159
161 void SafepointTableBuilder::Emit(Assembler* assembler, int bits_per_entry) { 160 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
162 // Make sure the safepoint table is properly aligned. Pad with nops. 169 // Make sure the safepoint table is properly aligned. Pad with nops.
163 assembler->Align(kIntSize); 170 assembler->Align(kIntSize);
164 assembler->RecordComment(";;; Safepoint table."); 171 assembler->RecordComment(";;; Safepoint table.");
165 offset_ = assembler->pc_offset(); 172 offset_ = assembler->pc_offset();
166 173
167 // Take the register bits into account. 174 // Take the register bits into account.
168 bits_per_entry += kNumSafepointRegisters; 175 bits_per_entry += kNumSafepointRegisters;
169 176
170 // Compute the number of bytes per safepoint entry. 177 // Compute the number of bytes per safepoint entry.
171 int bytes_per_entry = 178 int bytes_per_entry =
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 unsigned index) { 236 unsigned index) {
230 uint32_t encoding = SafepointEntry::DeoptimizationIndexField::encode(index); 237 uint32_t encoding = SafepointEntry::DeoptimizationIndexField::encode(index);
231 encoding |= SafepointEntry::ArgumentsField::encode(info.arguments); 238 encoding |= SafepointEntry::ArgumentsField::encode(info.arguments);
232 encoding |= SafepointEntry::SaveDoublesField::encode(info.has_doubles); 239 encoding |= SafepointEntry::SaveDoublesField::encode(info.has_doubles);
233 return encoding; 240 return encoding;
234 } 241 }
235 242
236 243
237 244
238 } } // namespace v8::internal 245 } } // 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