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

Unified Diff: src/stub-cache.cc

Issue 8883011: Implement ICs for constructor calls. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years 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') | no next file » | 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 8b6e28f9f5db5cd780513f2d00b4085949083500..00be5d5c57674104237fb1b5dd6617f36d595c02 100644
--- a/src/stub-cache.cc
+++ b/src/stub-cache.cc
@@ -692,6 +692,7 @@ Code* StubCache::FindCallInitialize(int argc,
Code::Kind kind) {
Code::ExtraICState extra_state =
CallICBase::StringStubState::encode(DEFAULT_STRING_STUB) |
+ CallICBase::ConstructCall::encode(mode == RelocInfo::CONSTRUCT_CALL) |
CallICBase::Contextual::encode(mode == RelocInfo::CODE_TARGET_CONTEXT);
Code::Flags flags =
Code::ComputeFlags(kind, UNINITIALIZED, extra_state, NORMAL, argc);
@@ -713,6 +714,7 @@ Handle<Code> StubCache::ComputeCallInitialize(int argc,
Code::Kind kind) {
Code::ExtraICState extra_state =
CallICBase::StringStubState::encode(DEFAULT_STRING_STUB) |
+ CallICBase::ConstructCall::encode(mode == RelocInfo::CONSTRUCT_CALL) |
CallICBase::Contextual::encode(mode == RelocInfo::CODE_TARGET_CONTEXT);
Code::Flags flags =
Code::ComputeFlags(kind, UNINITIALIZED, extra_state, NORMAL, argc);
@@ -732,9 +734,9 @@ Handle<Code> StubCache::ComputeCallInitialize(int argc, RelocInfo::Mode mode) {
}
-Handle<Code> StubCache::ComputeKeyedCallInitialize(int argc) {
- return ComputeCallInitialize(argc, RelocInfo::CODE_TARGET,
- Code::KEYED_CALL_IC);
+Handle<Code> StubCache::ComputeKeyedCallInitialize(int argc,
+ RelocInfo::Mode mode) {
+ return ComputeCallInitialize(argc, mode, Code::KEYED_CALL_IC);
}
@@ -771,11 +773,12 @@ Handle<Code> StubCache::ComputeCallNormal(int argc,
}
-Handle<Code> StubCache::ComputeCallArguments(int argc, Code::Kind kind) {
+Handle<Code> StubCache::ComputeCallArguments(int argc,
+ Code::Kind kind,
+ Code::ExtraICState extra_state) {
ASSERT(kind == Code::KEYED_CALL_IC);
Code::Flags flags =
- Code::ComputeFlags(kind, MEGAMORPHIC, Code::kNoExtraICState,
- NORMAL, argc);
+ Code::ComputeFlags(kind, MEGAMORPHIC, extra_state, NORMAL, argc);
Handle<NumberDictionary> cache = isolate_->factory()->non_monomorphic_cache();
int entry = cache->FindEntry(isolate_, flags);
if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry)));
@@ -792,8 +795,7 @@ Handle<Code> StubCache::ComputeCallMegamorphic(
Code::Kind kind,
Code::ExtraICState extra_state) {
Code::Flags flags =
- Code::ComputeFlags(kind, MEGAMORPHIC, extra_state,
- NORMAL, argc);
+ Code::ComputeFlags(kind, MEGAMORPHIC, extra_state, NORMAL, argc);
Handle<NumberDictionary> cache = isolate_->factory()->non_monomorphic_cache();
int entry = cache->FindEntry(isolate_, flags);
if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry)));
@@ -1129,7 +1131,7 @@ Handle<Code> StubCompiler::CompileCallInitialize(Code::Flags flags) {
if (kind == Code::CALL_IC) {
CallIC::GenerateInitialize(masm(), argc, extra_state);
} else {
- KeyedCallIC::GenerateInitialize(masm(), argc);
+ KeyedCallIC::GenerateInitialize(masm(), argc, extra_state);
}
Handle<Code> code = GetCodeWithFlags(flags, "CompileCallInitialize");
isolate()->counters()->call_initialize_stubs()->Increment();
@@ -1150,7 +1152,7 @@ Handle<Code> StubCompiler::CompileCallPreMonomorphic(Code::Flags flags) {
if (kind == Code::CALL_IC) {
CallIC::GenerateInitialize(masm(), argc, extra_state);
} else {
- KeyedCallIC::GenerateInitialize(masm(), argc);
+ KeyedCallIC::GenerateInitialize(masm(), argc, extra_state);
}
Handle<Code> code = GetCodeWithFlags(flags, "CompileCallPreMonomorphic");
isolate()->counters()->call_premonomorphic_stubs()->Increment();
@@ -1165,13 +1167,11 @@ Handle<Code> StubCompiler::CompileCallPreMonomorphic(Code::Flags flags) {
Handle<Code> StubCompiler::CompileCallNormal(Code::Flags flags) {
int argc = Code::ExtractArgumentsCountFromFlags(flags);
Code::Kind kind = Code::ExtractKindFromFlags(flags);
+ Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags);
if (kind == Code::CALL_IC) {
- // Call normal is always with a explict receiver.
- ASSERT(!CallIC::Contextual::decode(
- Code::ExtractExtraICStateFromFlags(flags)));
- CallIC::GenerateNormal(masm(), argc);
+ CallIC::GenerateNormal(masm(), argc, extra_state);
} else {
- KeyedCallIC::GenerateNormal(masm(), argc);
+ KeyedCallIC::GenerateNormal(masm(), argc, extra_state);
}
Handle<Code> code = GetCodeWithFlags(flags, "CompileCallNormal");
isolate()->counters()->call_normal_stubs()->Increment();
@@ -1190,7 +1190,7 @@ Handle<Code> StubCompiler::CompileCallMegamorphic(Code::Flags flags) {
if (kind == Code::CALL_IC) {
CallIC::GenerateMegamorphic(masm(), argc, extra_state);
} else {
- KeyedCallIC::GenerateMegamorphic(masm(), argc);
+ KeyedCallIC::GenerateMegamorphic(masm(), argc, extra_state);
}
Handle<Code> code = GetCodeWithFlags(flags, "CompileCallMegamorphic");
isolate()->counters()->call_megamorphic_stubs()->Increment();
@@ -1204,7 +1204,8 @@ Handle<Code> StubCompiler::CompileCallMegamorphic(Code::Flags flags) {
Handle<Code> StubCompiler::CompileCallArguments(Code::Flags flags) {
int argc = Code::ExtractArgumentsCountFromFlags(flags);
- KeyedCallIC::GenerateNonStrictArguments(masm(), argc);
+ Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags);
+ KeyedCallIC::GenerateNonStrictArguments(masm(), argc, extra_state);
Handle<Code> code = GetCodeWithFlags(flags, "CompileCallArguments");
PROFILE(isolate(),
CodeCreateEvent(CALL_LOGGER_TAG(Code::ExtractKindFromFlags(flags),
@@ -1222,7 +1223,7 @@ Handle<Code> StubCompiler::CompileCallMiss(Code::Flags flags) {
if (kind == Code::CALL_IC) {
CallIC::GenerateMiss(masm(), argc, extra_state);
} else {
- KeyedCallIC::GenerateMiss(masm(), argc);
+ KeyedCallIC::GenerateMiss(masm(), argc, extra_state);
}
Handle<Code> code = GetCodeWithFlags(flags, "CompileCallMiss");
isolate()->counters()->call_megamorphic_stubs()->Increment();
@@ -1251,11 +1252,12 @@ Handle<Code> StubCompiler::CompileCallDebugPrepareStepIn(Code::Flags flags) {
// miss case.
int argc = Code::ExtractArgumentsCountFromFlags(flags);
Code::Kind kind = Code::ExtractKindFromFlags(flags);
+ Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags);
if (kind == Code::CALL_IC) {
// For the debugger extra ic state is irrelevant.
- CallIC::GenerateMiss(masm(), argc, Code::kNoExtraICState);
+ CallIC::GenerateMiss(masm(), argc, extra_state);
} else {
- KeyedCallIC::GenerateMiss(masm(), argc);
+ KeyedCallIC::GenerateMiss(masm(), argc, extra_state);
}
Handle<Code> code = GetCodeWithFlags(flags, "CompileCallDebugPrepareStepIn");
PROFILE(isolate(),
« no previous file with comments | « src/stub-cache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698