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

Unified Diff: src/stub-cache.cc

Issue 14367018: Add monomorphic CompareNilICs and Crankshaft support (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 7 years, 8 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/stub-cache.h ('k') | src/type-info.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/stub-cache.cc
diff --git a/src/stub-cache.cc b/src/stub-cache.cc
index 396e92ce39a6601295a6632de73088a0e05fec2f..f099c5d3d31eab1c47d81950cf08d2efb2f34069 100644
--- a/src/stub-cache.cc
+++ b/src/stub-cache.cc
@@ -110,18 +110,28 @@ Handle<JSObject> StubCache::StubHolder(Handle<JSObject> receiver,
Handle<Code> StubCache::FindIC(Handle<Name> name,
- Handle<JSObject> stub_holder,
+ Handle<Map> stub_holder_map,
Code::Kind kind,
Code::StubType type,
- Code::ExtraICState extra_ic_state) {
- Code::Flags flags = Code::ComputeMonomorphicFlags(kind, extra_ic_state, type);
- Handle<Object> probe(stub_holder->map()->FindInCodeCache(*name, flags),
+ Code::ExtraICState extra_state) {
+ Code::Flags flags = Code::ComputeMonomorphicFlags(kind, extra_state, type);
+ Handle<Object> probe(stub_holder_map->FindInCodeCache(*name, flags),
isolate_);
if (probe->IsCode()) return Handle<Code>::cast(probe);
return Handle<Code>::null();
}
+Handle<Code> StubCache::FindIC(Handle<Name> name,
+ Handle<JSObject> stub_holder,
+ Code::Kind kind,
+ Code::StubType type,
+ Code::ExtraICState extra_ic_state) {
+ return FindIC(name, Handle<Map>(stub_holder->map()), kind,
+ type, extra_ic_state);
+}
+
+
Handle<Code> StubCache::FindHandler(Handle<Name> name,
Handle<JSObject> receiver,
Handle<JSObject> stub_holder,
@@ -487,7 +497,8 @@ Handle<Code> StubCache::ComputeStoreGlobal(Handle<Name> name,
Handle<JSGlobalPropertyCell> cell,
StrictModeFlag strict_mode) {
Handle<Code> stub = FindIC(
- name, receiver, Code::STORE_IC, Code::NORMAL, strict_mode);
+ name, Handle<JSObject>::cast(receiver),
+ Code::STORE_IC, Code::NORMAL, strict_mode);
if (!stub.is_null()) return stub;
StoreStubCompiler compiler(isolate_, strict_mode);
@@ -893,6 +904,32 @@ Handle<Code> StubCache::ComputeCallMiss(int argc,
}
+Handle<Code> StubCache::ComputeCompareNil(Handle<Map> receiver_map,
+ NilValue nil,
+ CompareNilICStub::Types types) {
+ CompareNilICStub stub(kNonStrictEquality, nil, types);
+
+ Handle<String> name(isolate_->heap()->empty_string());
+ if (!receiver_map->is_shared()) {
+ Handle<Code> cached_ic = FindIC(name, receiver_map, Code::COMPARE_NIL_IC,
+ Code::NORMAL, stub.GetExtraICState());
+ if (!cached_ic.is_null()) return cached_ic;
+ }
+
+ Handle<Code> ic = stub.GetCode(isolate_);
+ // For monomorphic maps, use the code as a template, copying and replacing
+ // the monomorphic map that checks the object's type.
+ ic = isolate_->factory()->CopyCode(ic);
+ ic->ReplaceFirstMap(*receiver_map);
+
+ if (!receiver_map->is_shared()) {
+ Map::UpdateCodeCache(receiver_map, name, ic);
+ }
+
+ return ic;
+}
+
+
Handle<Code> StubCache::ComputeLoadElementPolymorphic(
MapHandleList* receiver_maps) {
Code::Flags flags = Code::ComputeFlags(Code::KEYED_LOAD_IC, POLYMORPHIC);
« no previous file with comments | « src/stub-cache.h ('k') | src/type-info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698