Reviewers: Yang,
Message:
PTAL #10
Description:
ContextSlotCache::Update() handlified.
Please review this at https://codereview.chromium.org/263613003/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+17, -18 lines):
M src/scopeinfo.h
M src/scopeinfo.cc
Index: src/scopeinfo.cc
diff --git a/src/scopeinfo.cc b/src/scopeinfo.cc
index
a44ac613aa5a83da88ffdb8837c5a26394bfd3a8..eaf9964b16f4a2e75b159f1ef3a1d13841aedb88
100644
--- a/src/scopeinfo.cc
+++ b/src/scopeinfo.cc
@@ -307,15 +307,14 @@ int ScopeInfo::ContextSlotIndex(Handle<ScopeInfo>
scope_info,
*mode = scope_info->ContextLocalMode(var);
*init_flag = scope_info->ContextLocalInitFlag(var);
result = Context::MIN_CONTEXT_SLOTS + var;
- context_slot_cache->Update(
- *scope_info, *name, *mode, *init_flag, result);
+ context_slot_cache->Update(scope_info, name, *mode, *init_flag,
result);
ASSERT(result < scope_info->ContextLength());
return result;
}
}
// Cache as not found. Mode and init flag don't matter.
context_slot_cache->Update(
- *scope_info, *name, INTERNAL, kNeedsInitialization, -1);
+ scope_info, name, INTERNAL, kNeedsInitialization, -1);
}
return -1;
}
@@ -432,18 +431,18 @@ int ContextSlotCache::Lookup(Object* data,
}
-void ContextSlotCache::Update(Object* data,
- String* name,
+void ContextSlotCache::Update(Handle<Object> data,
+ Handle<String> name,
VariableMode mode,
InitializationFlag init_flag,
int slot_index) {
String* internalized_name;
ASSERT(slot_index > kNotFound);
if (name->GetIsolate()->heap()->InternalizeStringIfExists(
- name, &internalized_name)) {
- int index = Hash(data, internalized_name);
+ *name, &internalized_name)) {
+ int index = Hash(*data, internalized_name);
Key& key = keys_[index];
- key.data = data;
+ key.data = *data;
key.name = internalized_name;
// Please note value only takes a uint as index.
values_[index] = Value(mode, init_flag, slot_index - kNotFound).raw();
@@ -461,18 +460,18 @@ void ContextSlotCache::Clear() {
#ifdef DEBUG
-void ContextSlotCache::ValidateEntry(Object* data,
- String* name,
+void ContextSlotCache::ValidateEntry(Handle<Object> data,
+ Handle<String> name,
VariableMode mode,
InitializationFlag init_flag,
int slot_index) {
String* internalized_name;
if (name->GetIsolate()->heap()->InternalizeStringIfExists(
- name, &internalized_name)) {
- int index = Hash(data, name);
+ *name, &internalized_name)) {
+ int index = Hash(*data, *name);
Key& key = keys_[index];
- ASSERT(key.data == data);
- ASSERT(key.name->Equals(name));
+ ASSERT(key.data == *data);
+ ASSERT(key.name->Equals(*name));
Value result(values_[index]);
ASSERT(result.mode() == mode);
ASSERT(result.initialization_flag() == init_flag);
Index: src/scopeinfo.h
diff --git a/src/scopeinfo.h b/src/scopeinfo.h
index
9a13b8248e07704f10f587f63027b9eadcf7cff5..755b6a3101376744dc99668fa3b68376e7598362
100644
--- a/src/scopeinfo.h
+++ b/src/scopeinfo.h
@@ -26,8 +26,8 @@ class ContextSlotCache {
InitializationFlag* init_flag);
// Update an element in the cache.
- void Update(Object* data,
- String* name,
+ void Update(Handle<Object> data,
+ Handle<String> name,
VariableMode mode,
InitializationFlag init_flag,
int slot_index);
@@ -49,8 +49,8 @@ class ContextSlotCache {
inline static int Hash(Object* data, String* name);
#ifdef DEBUG
- void ValidateEntry(Object* data,
- String* name,
+ void ValidateEntry(Handle<Object> data,
+ Handle<String> name,
VariableMode mode,
InitializationFlag init_flag,
int slot_index);
--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.