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

Unified Diff: src/objects.cc

Issue 2466553002: [ic] Simplify handling of primitive maps. (Closed)
Patch Set: Now with enabled data-drived ICs Created 4 years, 1 month 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/objects.h ('k') | src/prototype.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index fb594fd2d6c9102de48f3da44c002958dd19ba5b..4582ba41c14abec9f816cf980d2abee00186a0a8 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -1925,7 +1925,7 @@ Maybe<bool> JSReceiver::HasInPrototypeChain(Isolate* isolate,
}
}
-Map* Object::GetRootMap(Isolate* isolate) {
+Map* Object::GetPrototypeChainRootMap(Isolate* isolate) {
DisallowHeapAllocation no_alloc;
if (IsSmi()) {
Context* native_context = isolate->context()->native_context();
@@ -1935,11 +1935,15 @@ Map* Object::GetRootMap(Isolate* isolate) {
// The object is either a number, a string, a symbol, a boolean, a SIMD value,
// a real JS object, or a Harmony proxy.
HeapObject* heap_object = HeapObject::cast(this);
- if (heap_object->IsJSReceiver()) {
- return heap_object->map();
+ return heap_object->map()->GetPrototypeChainRootMap(isolate);
+}
+
+Map* Map::GetPrototypeChainRootMap(Isolate* isolate) {
+ DisallowHeapAllocation no_alloc;
+ if (IsJSReceiverMap()) {
+ return this;
}
- int constructor_function_index =
- heap_object->map()->GetConstructorFunctionIndex();
+ int constructor_function_index = GetConstructorFunctionIndex();
if (constructor_function_index != Map::kNoConstructorFunctionIndex) {
Context* native_context = isolate->context()->native_context();
JSFunction* constructor_function =
@@ -12728,7 +12732,8 @@ void Map::SetShouldBeFastPrototypeMap(Handle<Map> map, bool value,
// static
Handle<Cell> Map::GetOrCreatePrototypeChainValidityCell(Handle<Map> map,
Isolate* isolate) {
- Handle<Object> maybe_prototype(map->prototype(), isolate);
+ Handle<Object> maybe_prototype(
+ map->GetPrototypeChainRootMap(isolate)->prototype(), isolate);
if (!maybe_prototype->IsJSObject()) return Handle<Cell>::null();
Handle<JSObject> prototype = Handle<JSObject>::cast(maybe_prototype);
// Ensure the prototype is registered with its own prototypes so its cell
« no previous file with comments | « src/objects.h ('k') | src/prototype.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698