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

Unified Diff: runtime/vm/code_index_table.cc

Issue 9475031: Cleaned up usage of Function::code, since it may be misunderstood that it points to the only Code o… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/code_index_table.h ('k') | runtime/vm/code_index_table_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/code_index_table.cc
===================================================================
--- runtime/vm/code_index_table.cc (revision 4655)
+++ runtime/vm/code_index_table.cc (working copy)
@@ -34,8 +34,7 @@
}
-void CodeIndexTable::AddFunction(const Function& func) {
- const Code& code = Code::Handle(func.code());
+void CodeIndexTable::AddCode(const Code& code) {
ASSERT(!code.IsNull());
uword entrypoint = code.EntryPoint(); // Entry point for a function.
intptr_t instr_size = code.Size(); // Instructions size for the function.
@@ -48,22 +47,13 @@
}
ASSERT(page_index != -1);
// Add the entrypoint, size and function object at the specified index.
- AddFunctionToList(page_index, entrypoint, instr_size, func);
+ AddCodeToList(page_index, entrypoint, instr_size, code);
} else {
- AddLargeFunction(entrypoint, instr_size, func);
+ AddLargeCode(entrypoint, instr_size, code);
}
}
-RawFunction* CodeIndexTable::LookupFunction(uword pc) const {
- const Code& code = Code::Handle(LookupCode(pc));
- if (code.IsNull()) {
- return Function::null();
- }
- return code.function();
-}
-
-
RawCode* CodeIndexTable::LookupCode(uword pc) const {
uword page_start = (pc & ~(PageSpace::kPageSize - 1));
int page_index = FindPageIndex(page_start);
@@ -131,10 +121,10 @@
}
-void CodeIndexTable::AddFunctionToList(int page_index,
- uword entrypoint,
- intptr_t size,
- const Function& func) {
+void CodeIndexTable::AddCodeToList(int page_index,
+ uword entrypoint,
+ intptr_t size,
+ const Code& code) {
// Get PC ranges index array at specified index.
IndexArray<PcRange>* pc_ranges = code_pages_->At(page_index).pc_ranges;
ASSERT(pc_ranges != NULL);
@@ -146,7 +136,7 @@
ASSERT(!codes.IsNull());
// Asserting with an unsorted search, to ensure addition of pc was done right.
ASSERT(FindPcIndex(*pc_ranges, entrypoint, kIsNotSorted) == -1);
- AddFuncHelper(pc_ranges, codes, entrypoint, size, func);
+ AddCodeHelper(pc_ranges, codes, entrypoint, size, code);
if (pc_ranges->IsFull()) {
// Grow the pc ranges table and the associated functions table.
int new_size = pc_ranges->length() + kInitialSize;
@@ -157,9 +147,9 @@
}
-void CodeIndexTable::AddLargeFunction(uword entrypoint,
- intptr_t size,
- const Function& func) {
+void CodeIndexTable::AddLargeCode(uword entrypoint,
+ intptr_t size,
+ const Code& code) {
if (largecode_pc_ranges_ == NULL) {
// No large functions seen so far.
largecode_pc_ranges_ = new IndexArray<PcRange>(kInitialSize);
@@ -169,7 +159,7 @@
ASSERT(FindPcIndex(*largecode_pc_ranges_, entrypoint, kIsNotSorted) == -1);
const Array& largecode_list = Array::Handle(largecode_list_);
ASSERT(!largecode_list.IsNull());
- AddFuncHelper(largecode_pc_ranges_, largecode_list, entrypoint, size, func);
+ AddCodeHelper(largecode_pc_ranges_, largecode_list, entrypoint, size, code);
if (largecode_pc_ranges_->IsFull()) {
// Grow largecode_pc_ranges_ and largecode_list_.
int new_size = largecode_pc_ranges_->length() + kInitialSize;
@@ -179,17 +169,17 @@
}
-void CodeIndexTable::AddFuncHelper(IndexArray<PcRange>* pc_ranges,
+void CodeIndexTable::AddCodeHelper(IndexArray<PcRange>* pc_ranges,
const Array& codes,
uword entrypoint,
intptr_t size,
- const Function& func) {
+ const Code& code) {
PcRange pc_range;
pc_range.entrypoint = entrypoint;
pc_range.size = size;
intptr_t next_slot = pc_ranges->length();
pc_ranges->Add(pc_range); // pc_range gets added at 'next_slot'.
- codes.SetAt(next_slot, Code::Handle(func.code()));
+ codes.SetAt(next_slot, code);
}
« no previous file with comments | « runtime/vm/code_index_table.h ('k') | runtime/vm/code_index_table_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698