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

Unified Diff: src/stub-cache.cc

Issue 148503002: A64: Synchronize with r15545. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 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/sweeper-thread.cc » ('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 e0839f13d2b4d33cfe2edbb00994209e2d34e387..0ccd5e61b403a3946dc5ad4d4f157860526b6026 100644
--- a/src/stub-cache.cc
+++ b/src/stub-cache.cc
@@ -31,6 +31,7 @@
#include "arguments.h"
#include "ast.h"
#include "code-stubs.h"
+#include "cpu-profiler.h"
#include "gdb-jit.h"
#include "ic-inl.h"
#include "stub-cache.h"
@@ -498,15 +499,30 @@ Handle<Code> StubCache::ComputeStoreNormal(StrictModeFlag strict_mode) {
Handle<Code> StubCache::ComputeStoreGlobal(Handle<Name> name,
Handle<GlobalObject> receiver,
Handle<PropertyCell> cell,
+ Handle<Object> value,
StrictModeFlag strict_mode) {
- Handle<Code> stub = FindIC(
- name, Handle<JSObject>::cast(receiver),
- Code::STORE_IC, Code::NORMAL, strict_mode);
- if (!stub.is_null()) return stub;
+ Isolate* isolate = cell->GetIsolate();
+ Handle<Type> union_type(PropertyCell::UpdateType(cell, value), isolate);
+ bool is_constant = union_type->IsConstant();
+ StoreGlobalStub stub(strict_mode, is_constant);
- StoreStubCompiler compiler(isolate_, strict_mode);
- Handle<Code> code = compiler.CompileStoreGlobal(receiver, cell, name);
+ Handle<Code> code = FindIC(
+ name, Handle<JSObject>::cast(receiver),
+ Code::STORE_IC, Code::NORMAL, stub.GetExtraICState());
+ if (!code.is_null()) return code;
+
+ if (is_constant) return stub.GetCode(isolate_);
+
+ // Replace the placeholder cell and global object map with the actual global
+ // cell and receiver map.
+ Handle<Map> cell_map(isolate_->heap()->global_property_cell_map());
+ Handle<Map> meta_map(isolate_->heap()->meta_map());
+ Handle<Object> receiver_map(receiver->map(), isolate_);
+ code = stub.GetCodeCopyFromTemplate(isolate_);
+ code->ReplaceNthObject(1, *meta_map, *receiver_map);
+ code->ReplaceNthObject(1, *cell_map, *cell);
JSObject::UpdateMapCodeCache(receiver, name, code);
+
return code;
}
@@ -921,12 +937,8 @@ Handle<Code> StubCache::ComputeCompareNil(Handle<Map> receiver_map,
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);
+ Handle<Code> ic = stub.GetCodeCopyFromTemplate(isolate_);
+ ic->ReplaceNthObject(1, isolate_->heap()->meta_map(), *receiver_map);
if (!receiver_map->is_shared()) {
Map::UpdateCodeCache(receiver_map, name, ic);
@@ -2044,6 +2056,7 @@ CallOptimization::CallOptimization(LookupResult* lookup) {
}
}
+
CallOptimization::CallOptimization(Handle<JSFunction> function) {
Initialize(function);
}
« no previous file with comments | « src/stub-cache.h ('k') | src/sweeper-thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698