// Record source position for debugger.
SetSourcePosition(expr->position());
// Call the IC initialization code.
- Handle<Code> ic =
- isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode);
+ Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(arg_count);
TypeFeedbackId ast_id = mode == CONTEXTUAL
? TypeFeedbackId::None()
: expr->CallFeedbackId();
if (expr->is_jsruntime()) {
// Call the JS runtime function.
__ mov(r2, Operand(expr->name()));
- ContextualMode mode = NOT_CONTEXTUAL;
- Handle<Code> ic =
- isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode);
- CallIC(ic, mode, expr->CallRuntimeFeedbackId());
+ Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(arg_count);
+ CallIC(ic, NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId());
// Restore context register.
__ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
} else {
ASSERT(ToRegister(instr->result()).is(r0));
int arity = instr->arity();
- Handle<Code> ic =
- isolate()->stub_cache()->ComputeCallInitialize(arity, NOT_CONTEXTUAL);
+ Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(arity);
__ mov(r2, Operand(instr->name()));
CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
}
ASSERT(ToRegister(instr->result()).is(r0));
int arity = instr->arity();
- Handle<Code> ic =
- isolate()->stub_cache()->ComputeCallInitialize(arity, CONTEXTUAL);
+ Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(arity);
__ mov(r2, Operand(instr->name()));
CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
}
}
-void Call::RecordTypeFeedback(TypeFeedbackOracle* oracle,
- ContextualMode contextual_mode) {
+void Call::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
is_monomorphic_ = oracle->CallIsMonomorphic(CallFeedbackId());
Property* property = expression()->AsProperty();
if (property == NULL) {
receiver_types_.Clear();
if (check_type_ == RECEIVER_MAP_CHECK) {
oracle->CallReceiverTypes(CallFeedbackId(),
- name, arguments()->length(), contextual_mode, &receiver_types_);
+ name, arguments()->length(), &receiver_types_);
is_monomorphic_ = is_monomorphic_ && receiver_types_.length() > 0;
} else {
holder_ = GetPrototypeForPrimitiveCheck(check_type_, oracle->isolate());
// Type feedback information.
TypeFeedbackId CallFeedbackId() const { return reuse(id()); }
- void RecordTypeFeedback(TypeFeedbackOracle* oracle,
- ContextualMode contextual_mode);
+ void RecordTypeFeedback(TypeFeedbackOracle* oracle);
virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE {
return &receiver_types_;
}
// Record source position of the IC call.
SetSourcePosition(expr->position());
Handle<Code> ic =
- isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode);
+ isolate()->stub_cache()->ComputeCallInitialize(arg_count);
TypeFeedbackId ast_id = mode == CONTEXTUAL
? TypeFeedbackId::None()
: expr->CallFeedbackId();
if (expr->is_jsruntime()) {
// Call the JS runtime function via a call IC.
__ Set(ecx, Immediate(expr->name()));
- ContextualMode mode = NOT_CONTEXTUAL;
- Handle<Code> ic =
- isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode);
- CallIC(ic, mode, expr->CallRuntimeFeedbackId());
+ Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(arg_count);
+ CallIC(ic, NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId());
// Restore context register.
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
} else {
ASSERT(ToRegister(instr->result()).is(eax));
int arity = instr->arity();
- Handle<Code> ic =
- isolate()->stub_cache()->ComputeCallInitialize(arity, NOT_CONTEXTUAL);
+ Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(arity);
__ mov(ecx, instr->name());
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
ASSERT(ToRegister(instr->result()).is(eax));
int arity = instr->arity();
- Handle<Code> ic =
- isolate()->stub_cache()->ComputeCallInitialize(arity, CONTEXTUAL);
+ Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(arity);
__ mov(ecx, instr->name());
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
void CallICBase::Clear(Address address, Code* target) {
if (IsCleared(target)) return;
- ContextualMode mode = IC::GetContextualMode(target->extra_ic_state());
Code* code = target->GetIsolate()->stub_cache()->FindCallInitialize(
- target->arguments_count(), mode, target->kind());
+ target->arguments_count(), target->kind());
SetTargetAtAddress(address, code);
}
// access to properties.
bool IsUndeclaredGlobal(Handle<Object> receiver) {
if (receiver->IsGlobalObject()) {
- return IsContextual();
+ return IsCallStub() || IsContextual();
} else {
ASSERT(!IsContextual());
return false;
return target()->is_store_stub() || target()->is_keyed_store_stub();
}
+#endif
bool IsCallStub() {
return target()->is_call_stub() || target()->is_keyed_call_stub();
}
-#endif
// Determines which map must be used for keeping the code stub.
// These methods should not be called with undefined or null.
class CallICBase: public IC {
public:
// ExtraICState bits
- class StringStubState: public BitField<StringStubFeedback, 1, 1> {};
- static ExtraICState ComputeExtraICState(ContextualMode mode,
- StringStubFeedback feedback) {
- return Contextual::encode(mode) | StringStubState::encode(feedback);
+ class StringStubState: public BitField<StringStubFeedback, 0, 1> {};
+ static ExtraICState ComputeExtraICState(StringStubFeedback feedback) {
+ return StringStubState::encode(feedback);
}
// Returns a JSFunction or a Failure.
}
-Code* StubCache::FindCallInitialize(int argc,
- ContextualMode mode,
- Code::Kind kind) {
+Code* StubCache::FindCallInitialize(int argc, Code::Kind kind) {
ExtraICState extra_state =
- CallICBase::StringStubState::encode(DEFAULT_STRING_STUB) |
- CallICBase::Contextual::encode(mode);
+ CallICBase::StringStubState::encode(DEFAULT_STRING_STUB);
Code::Flags flags =
Code::ComputeFlags(kind, UNINITIALIZED, extra_state, Code::NORMAL, argc);
UnseededNumberDictionary* dictionary =
}
-Handle<Code> StubCache::ComputeCallInitialize(int argc,
- ContextualMode mode,
- Code::Kind kind) {
+Handle<Code> StubCache::ComputeCallInitialize(int argc, Code::Kind kind) {
ExtraICState extra_state =
- CallICBase::ComputeExtraICState(mode, DEFAULT_STRING_STUB);
+ CallICBase::ComputeExtraICState(DEFAULT_STRING_STUB);
Code::Flags flags =
Code::ComputeFlags(kind, UNINITIALIZED, extra_state, Code::NORMAL, argc);
Handle<UnseededNumberDictionary> cache =
}
-Handle<Code> StubCache::ComputeCallInitialize(int argc, ContextualMode mode) {
- return ComputeCallInitialize(argc, mode, Code::CALL_IC);
+Handle<Code> StubCache::ComputeCallInitialize(int argc) {
+ return ComputeCallInitialize(argc, Code::CALL_IC);
}
Handle<Code> StubCache::ComputeKeyedCallInitialize(int argc) {
- return ComputeCallInitialize(argc, NOT_CONTEXTUAL, Code::KEYED_CALL_IC);
+ return ComputeCallInitialize(argc, Code::KEYED_CALL_IC);
}
// ---
- Handle<Code> ComputeCallInitialize(int argc, ContextualMode mode);
+ Handle<Code> ComputeCallInitialize(int argc);
Handle<Code> ComputeKeyedCallInitialize(int argc);
ExtraICState extra_ic_state);
// Finds the Code object stored in the Heap::non_monomorphic_cache().
- Code* FindCallInitialize(int argc, ContextualMode mode, Code::Kind kind);
+ Code* FindCallInitialize(int argc, Code::Kind kind);
Code* FindPreMonomorphicIC(Code::Kind kind, ExtraICState extra_ic_state);
#ifdef ENABLE_DEBUGGER_SUPPORT
private:
explicit StubCache(Isolate* isolate);
- Handle<Code> ComputeCallInitialize(int argc,
- ContextualMode mode,
- Code::Kind kind);
+ Handle<Code> ComputeCallInitialize(int argc, Code::Kind kind);
// The stub cache has a primary and secondary level. The two levels have
// different hashing algorithms in order to avoid simultaneous collisions
void TypeFeedbackOracle::CallReceiverTypes(TypeFeedbackId id,
Handle<String> name,
int arity,
- ContextualMode contextual_mode,
SmallMapList* types) {
// Note: Currently we do not take string extra ic data into account
// here.
- ExtraICState extra_ic_state =
- CallIC::Contextual::encode(contextual_mode);
Code::Flags flags = Code::ComputeMonomorphicFlags(
- Code::CALL_IC, extra_ic_state, OWN_MAP, Code::NORMAL, arity);
+ Code::CALL_IC, kNoExtraICState, OWN_MAP, Code::NORMAL, arity);
CollectReceiverTypes(id, name, flags, types);
}
void CallReceiverTypes(TypeFeedbackId id,
Handle<String> name,
int arity,
- ContextualMode contextual_mode,
SmallMapList* types);
void PropertyReceiverTypes(TypeFeedbackId id,
Handle<String> name,
void AstTyper::VisitCall(Call* expr) {
- Expression* callee = expr->expression();
- Property* prop = callee->AsProperty();
- ContextualMode contextual_mode = prop == NULL ? CONTEXTUAL : NOT_CONTEXTUAL;
// Collect type feedback.
- expr->RecordTypeFeedback(oracle(), contextual_mode);
+ expr->RecordTypeFeedback(oracle());
RECURSE(Visit(expr->expression()));
ZoneList<Expression*>* args = expr->arguments();
// Record source position for debugger.
SetSourcePosition(expr->position());
// Call the IC initialization code.
- Handle<Code> ic =
- isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode);
+ Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(arg_count);
TypeFeedbackId ast_id = mode == CONTEXTUAL
? TypeFeedbackId::None()
: expr->CallFeedbackId();
if (expr->is_jsruntime()) {
// Call the JS runtime function using a call IC.
__ Move(rcx, expr->name());
- ContextualMode mode = NOT_CONTEXTUAL;
- Handle<Code> ic =
- isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode);
- CallIC(ic, mode, expr->CallRuntimeFeedbackId());
+ Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(arg_count);
+ CallIC(ic, NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId());
// Restore context register.
__ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
} else {
ASSERT(ToRegister(instr->result()).is(rax));
int arity = instr->arity();
- Handle<Code> ic =
- isolate()->stub_cache()->ComputeCallInitialize(arity, NOT_CONTEXTUAL);
+ Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(arity);
__ Move(rcx, instr->name());
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
ASSERT(ToRegister(instr->context()).is(rsi));
ASSERT(ToRegister(instr->result()).is(rax));
int arity = instr->arity();
- Handle<Code> ic =
- isolate()->stub_cache()->ComputeCallInitialize(arity, CONTEXTUAL);
+ Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(arity);
__ Move(rcx, instr->name());
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
HandleScope inner_scope(isolate);
AlwaysAllocateScope always_allocate;
SimulateFullSpace(heap->code_space());
- isolate->stub_cache()->ComputeCallInitialize(9, NOT_CONTEXTUAL);
+ isolate->stub_cache()->ComputeCallInitialize(9);
}
// Second compile a CallIC and execute it once so that it gets patched to
// Flags: --allow-natives-syntax
-assertThrows("%foobar();", TypeError);
-assertThrows("%constructor();", TypeError);
-assertThrows("%constructor(23);", TypeError);
+assertThrows("%foobar();", Error);
+assertThrows("%constructor();", Error);
+assertThrows("%constructor(23);", Error);
// Flags: --allow-natives-syntax
assertThrows("f()", ReferenceError);
-assertThrows("%f()", TypeError);
+assertThrows("%f()", Error);
assertThrows("%_f()", SyntaxError);