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

Unified Diff: src/ic.cc

Issue 12210083: Renamed "symbols" to "internalized strings" throughout the code base, (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Yang's comments Created 7 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 | « src/ic.h ('k') | src/interface.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic.cc
diff --git a/src/ic.cc b/src/ic.cc
index b74b0d966afccd2dc5d3925d11c77b2c8ffca907..728b053b45b149b28dfc7e5d6a2da11b2c2d4f80 100644
--- a/src/ic.cc
+++ b/src/ic.cc
@@ -755,7 +755,7 @@ void CallICBase::UpdateCaches(LookupResult* lookup,
MaybeObject* KeyedCallIC::LoadFunction(State state,
Handle<Object> object,
Handle<Object> key) {
- if (key->IsSymbol()) {
+ if (key->IsInternalizedString()) {
return CallICBase::LoadFunction(state,
Code::kNoExtraICState,
object,
@@ -816,7 +816,7 @@ MaybeObject* LoadIC::Load(State state,
// objects is read-only and therefore always returns the length of
// the underlying string value. See ECMA-262 15.5.5.1.
if ((object->IsString() || object->IsStringWrapper()) &&
- name->Equals(isolate()->heap()->length_symbol())) {
+ name->Equals(isolate()->heap()->length_string())) {
Handle<Code> stub;
if (state == UNINITIALIZED) {
stub = pre_monomorphic_stub();
@@ -845,7 +845,7 @@ MaybeObject* LoadIC::Load(State state,
// Use specialized code for getting the length of arrays.
if (object->IsJSArray() &&
- name->Equals(isolate()->heap()->length_symbol())) {
+ name->Equals(isolate()->heap()->length_string())) {
Handle<Code> stub;
if (state == UNINITIALIZED) {
stub = pre_monomorphic_stub();
@@ -867,7 +867,7 @@ MaybeObject* LoadIC::Load(State state,
// Use specialized code for getting prototype of functions.
if (object->IsJSFunction() &&
- name->Equals(isolate()->heap()->prototype_symbol()) &&
+ name->Equals(isolate()->heap()->prototype_string()) &&
Handle<JSFunction>::cast(object)->should_have_prototype()) {
Handle<Code> stub;
if (state == UNINITIALIZED) {
@@ -1088,7 +1088,7 @@ static Handle<Object> TryConvertKey(Handle<Object> key, Isolate* isolate) {
if (key->IsHeapNumber()) {
double value = Handle<HeapNumber>::cast(key)->value();
if (isnan(value)) {
- key = isolate->factory()->nan_symbol();
+ key = isolate->factory()->nan_string();
} else {
int int_value = FastD2I(value);
if (value == int_value && Smi::IsValid(int_value)) {
@@ -1096,7 +1096,7 @@ static Handle<Object> TryConvertKey(Handle<Object> key, Isolate* isolate) {
}
}
} else if (key->IsUndefined()) {
- key = isolate->factory()->undefined_symbol();
+ key = isolate->factory()->undefined_string();
}
return key;
}
@@ -1221,11 +1221,11 @@ MaybeObject* KeyedLoadIC::Load(State state,
Handle<Object> object,
Handle<Object> key,
ICMissMode miss_mode) {
- // Check for values that can be converted into a symbol directly or
- // is representable as a smi.
+ // Check for values that can be converted into an internalized string directly
+ // or is representable as a smi.
key = TryConvertKey(key, isolate());
- if (key->IsSymbol()) {
+ if (key->IsInternalizedString()) {
return LoadIC::Load(state, object, Handle<String>::cast(key));
}
@@ -1361,7 +1361,7 @@ MaybeObject* StoreIC::Store(State state,
// The length property of string values is read-only. Throw in strict mode.
if (strict_mode == kStrictMode && object->IsString() &&
- name->Equals(isolate()->heap()->length_symbol())) {
+ name->Equals(isolate()->heap()->length_string())) {
return TypeError("strict_read_only_property", object, name);
}
@@ -1390,7 +1390,7 @@ MaybeObject* StoreIC::Store(State state,
// property.
if (FLAG_use_ic &&
receiver->IsJSArray() &&
- name->Equals(isolate()->heap()->length_symbol()) &&
+ name->Equals(isolate()->heap()->length_string()) &&
Handle<JSArray>::cast(receiver)->AllowsSetElementsLength() &&
receiver->HasFastProperties()) {
Handle<Code> stub = StoreArrayLengthStub(kind(), strict_mode).GetCode();
@@ -1712,11 +1712,11 @@ MaybeObject* KeyedStoreIC::Store(State state,
Handle<Object> key,
Handle<Object> value,
ICMissMode miss_mode) {
- // Check for values that can be converted into a symbol directly or
- // is representable as a smi.
+ // Check for values that can be converted into an internalized string directly
+ // or is representable as a smi.
key = TryConvertKey(key, isolate());
- if (key->IsSymbol()) {
+ if (key->IsInternalizedString()) {
return StoreIC::Store(state,
strict_mode,
object,
@@ -1925,7 +1925,7 @@ RUNTIME_FUNCTION(MaybeObject*, StoreIC_ArrayLength) {
#ifdef DEBUG
// The length property has to be a writable callback property.
LookupResult debug_lookup(isolate);
- receiver->LocalLookup(isolate->heap()->length_symbol(), &debug_lookup);
+ receiver->LocalLookup(isolate->heap()->length_string(), &debug_lookup);
ASSERT(debug_lookup.IsPropertyCallbacks() && !debug_lookup.IsReadOnly());
#endif
@@ -2369,7 +2369,7 @@ const char* CompareIC::GetStateName(State state) {
case HEAP_NUMBER: return "HEAP_NUMBER";
case OBJECT: return "OBJECTS";
case KNOWN_OBJECTS: return "KNOWN_OBJECTS";
- case SYMBOL: return "SYMBOL";
+ case INTERNALIZED_STRING: return "INTERNALIZED_STRING";
case STRING: return "STRING";
case GENERIC: return "GENERIC";
default:
@@ -2385,7 +2385,7 @@ static CompareIC::State InputState(CompareIC::State old_state,
case CompareIC::UNINITIALIZED:
if (value->IsSmi()) return CompareIC::SMI;
if (value->IsHeapNumber()) return CompareIC::HEAP_NUMBER;
- if (value->IsSymbol()) return CompareIC::SYMBOL;
+ if (value->IsInternalizedString()) return CompareIC::INTERNALIZED_STRING;
if (value->IsString()) return CompareIC::STRING;
if (value->IsJSObject()) return CompareIC::OBJECT;
break;
@@ -2396,12 +2396,13 @@ static CompareIC::State InputState(CompareIC::State old_state,
case CompareIC::HEAP_NUMBER:
if (value->IsNumber()) return CompareIC::HEAP_NUMBER;
break;
- case CompareIC::SYMBOL:
- if (value->IsSymbol()) return CompareIC::SYMBOL;
+ case CompareIC::INTERNALIZED_STRING:
+ if (value->IsInternalizedString()) return CompareIC::INTERNALIZED_STRING;
if (value->IsString()) return CompareIC::STRING;
break;
case CompareIC::STRING:
- if (value->IsSymbol() || value->IsString()) return CompareIC::STRING;
+ if (value->IsInternalizedString() || value->IsString())
+ return CompareIC::STRING;
break;
case CompareIC::OBJECT:
if (value->IsJSObject()) return CompareIC::OBJECT;
@@ -2434,10 +2435,10 @@ CompareIC::State CompareIC::TargetState(State old_state,
return HEAP_NUMBER;
}
}
- if (x->IsSymbol() && y->IsSymbol()) {
- // We compare symbols as strings if we need to determine
+ if (x->IsInternalizedString() && y->IsInternalizedString()) {
+ // We compare internalized strings as plain ones if we need to determine
// the order in a non-equality compare.
- return Token::IsEqualityOp(op_) ? SYMBOL : STRING;
+ return Token::IsEqualityOp(op_) ? INTERNALIZED_STRING : STRING;
}
if (x->IsString() && y->IsString()) return STRING;
if (!Token::IsEqualityOp(op_)) return GENERIC;
@@ -2455,7 +2456,7 @@ CompareIC::State CompareIC::TargetState(State old_state,
return x->IsNumber() && y->IsNumber()
? HEAP_NUMBER
: GENERIC;
- case SYMBOL:
+ case INTERNALIZED_STRING:
ASSERT(Token::IsEqualityOp(op_));
return x->IsString() && y->IsString() ? STRING : GENERIC;
case HEAP_NUMBER:
« no previous file with comments | « src/ic.h ('k') | src/interface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698