| Index: src/code-stubs.cc
|
| diff --git a/src/code-stubs.cc b/src/code-stubs.cc
|
| index fdc6a15426b623298650af95faf700437b875c16..2ed2ba3c66413e68fc7f4b30f528f502fb5ee3fb 100644
|
| --- a/src/code-stubs.cc
|
| +++ b/src/code-stubs.cc
|
| @@ -184,79 +184,9 @@ const char* CodeStub::MajorName(CodeStub::Major major_key,
|
| }
|
| }
|
|
|
| -void CodeStub::PrintBaseName(StringStream* stream) {
|
| - stream->Add("%s", MajorName(MajorKey(), false));
|
| -}
|
| -
|
|
|
| void CodeStub::PrintName(StringStream* stream) {
|
| - PrintBaseName(stream);
|
| - PrintState(stream);
|
| -}
|
| -
|
| -
|
| -Builtins::JavaScript UnaryOpStub::ToJSBuiltin() {
|
| - switch (operation_) {
|
| - default:
|
| - UNREACHABLE();
|
| - case Token::SUB:
|
| - return Builtins::UNARY_MINUS;
|
| - case Token::BIT_NOT:
|
| - return Builtins::BIT_NOT;
|
| - }
|
| -}
|
| -
|
| -
|
| -Handle<JSFunction> UnaryOpStub::ToJSFunction(Isolate* isolate) {
|
| - Handle<JSBuiltinsObject> builtins(isolate->js_builtins_object());
|
| - Object* builtin = builtins->javascript_builtin(ToJSBuiltin());
|
| - return Handle<JSFunction>(JSFunction::cast(builtin), isolate);
|
| -}
|
| -
|
| -
|
| -MaybeObject* UnaryOpStub::Result(Handle<Object> object, Isolate* isolate) {
|
| - Handle<JSFunction> builtin_function = ToJSFunction(isolate);
|
| - bool caught_exception;
|
| - Handle<Object> result = Execution::Call(builtin_function, object,
|
| - 0, NULL, &caught_exception);
|
| - if (caught_exception) {
|
| - return Failure::Exception();
|
| - }
|
| - return *result;
|
| -}
|
| -
|
| -
|
| -void UnaryOpStub::UpdateStatus(Handle<Object> object) {
|
| - State old_state(state_);
|
| - if (object->IsSmi()) {
|
| - state_.Add(SMI);
|
| - if (operation_ == Token::SUB && *object == 0) {
|
| - // The result (-0) has to be represented as double.
|
| - state_.Add(HEAP_NUMBER);
|
| - }
|
| - } else if (object->IsHeapNumber()) {
|
| - state_.Add(HEAP_NUMBER);
|
| - } else {
|
| - state_.Add(GENERIC);
|
| - }
|
| - TraceTransition(old_state, state_);
|
| -}
|
| -
|
| -
|
| -Handle<Type> UnaryOpStub::GetType(Isolate* isolate) {
|
| - if (state_.Contains(GENERIC)) {
|
| - return handle(Type::Any(), isolate);
|
| - }
|
| - Handle<Type> type = handle(Type::None(), isolate);
|
| - if (state_.Contains(SMI)) {
|
| - type = handle(
|
| - Type::Union(type, handle(Type::Smi(), isolate)), isolate);
|
| - }
|
| - if (state_.Contains(HEAP_NUMBER)) {
|
| - type = handle(
|
| - Type::Union(type, handle(Type::Double(), isolate)), isolate);
|
| - }
|
| - return type;
|
| + stream->Add("%s", MajorName(MajorKey(), false));
|
| }
|
|
|
|
|
| @@ -345,29 +275,6 @@ void BinaryOpStub::GenerateCallRuntime(MacroAssembler* masm) {
|
| #undef __
|
|
|
|
|
| -void UnaryOpStub::PrintBaseName(StringStream* stream) {
|
| - CodeStub::PrintBaseName(stream);
|
| - if (operation_ == Token::SUB) stream->Add("Minus");
|
| - if (operation_ == Token::BIT_NOT) stream->Add("Not");
|
| -}
|
| -
|
| -
|
| -void UnaryOpStub::PrintState(StringStream* stream) {
|
| - state_.Print(stream);
|
| -}
|
| -
|
| -
|
| -void UnaryOpStub::State::Print(StringStream* stream) const {
|
| - stream->Add("(");
|
| - SimpleListPrinter printer(stream);
|
| - if (IsEmpty()) printer.Add("None");
|
| - if (Contains(GENERIC)) printer.Add("Generic");
|
| - if (Contains(HEAP_NUMBER)) printer.Add("HeapNumber");
|
| - if (Contains(SMI)) printer.Add("Smi");
|
| - stream->Add(")");
|
| -}
|
| -
|
| -
|
| void BinaryOpStub::PrintName(StringStream* stream) {
|
| const char* op_name = Token::Name(op_);
|
| const char* overwrite_name;
|
| @@ -524,9 +431,8 @@ void ICCompareStub::Generate(MacroAssembler* masm) {
|
| }
|
|
|
|
|
| -void CompareNilICStub::UpdateStatus(Handle<Object> object) {
|
| +void CompareNilICStub::Record(Handle<Object> object) {
|
| ASSERT(state_ != State::Generic());
|
| - State old_state(state_);
|
| if (object->IsNull()) {
|
| state_.Add(NULL_TYPE);
|
| } else if (object->IsUndefined()) {
|
| @@ -540,22 +446,18 @@ void CompareNilICStub::UpdateStatus(Handle<Object> object) {
|
| } else {
|
| state_.Add(MONOMORPHIC_MAP);
|
| }
|
| - TraceTransition(old_state, state_);
|
| }
|
|
|
|
|
| -template<class StateType>
|
| -void HydrogenCodeStub::TraceTransition(StateType from, StateType to) {
|
| +void CompareNilICStub::State::TraceTransition(State to) const {
|
| #ifdef DEBUG
|
| if (!FLAG_trace_ic) return;
|
| char buffer[100];
|
| NoAllocationStringAllocator allocator(buffer,
|
| static_cast<unsigned>(sizeof(buffer)));
|
| StringStream stream(&allocator);
|
| - stream.Add("[");
|
| - PrintBaseName(&stream);
|
| - stream.Add(": ");
|
| - from.Print(&stream);
|
| + stream.Add("[CompareNilIC : ");
|
| + Print(&stream);
|
| stream.Add("=>");
|
| to.Print(&stream);
|
| stream.Add("]\n");
|
| @@ -563,14 +465,12 @@ void HydrogenCodeStub::TraceTransition(StateType from, StateType to) {
|
| #endif
|
| }
|
|
|
| -void CompareNilICStub::PrintBaseName(StringStream* stream) {
|
| - CodeStub::PrintBaseName(stream);
|
| - stream->Add((nil_value_ == kNullValue) ? "(NullValue)":
|
| - "(UndefinedValue)");
|
| -}
|
|
|
| -void CompareNilICStub::PrintState(StringStream* stream) {
|
| +void CompareNilICStub::PrintName(StringStream* stream) {
|
| + stream->Add("CompareNilICStub_");
|
| state_.Print(stream);
|
| + stream->Add((nil_value_ == kNullValue) ? "(NullValue|":
|
| + "(UndefinedValue|");
|
| }
|
|
|
|
|
| @@ -715,15 +615,16 @@ void CallConstructStub::PrintName(StringStream* stream) {
|
| }
|
|
|
|
|
| -bool ToBooleanStub::UpdateStatus(Handle<Object> object) {
|
| +bool ToBooleanStub::Record(Handle<Object> object) {
|
| Types old_types(types_);
|
| - bool to_boolean_value = types_.UpdateStatus(object);
|
| - TraceTransition(old_types, types_);
|
| + bool to_boolean_value = types_.Record(object);
|
| + old_types.TraceTransition(types_);
|
| return to_boolean_value;
|
| }
|
|
|
|
|
| -void ToBooleanStub::PrintState(StringStream* stream) {
|
| +void ToBooleanStub::PrintName(StringStream* stream) {
|
| + stream->Add("ToBooleanStub_");
|
| types_.Print(stream);
|
| }
|
|
|
| @@ -744,7 +645,24 @@ void ToBooleanStub::Types::Print(StringStream* stream) const {
|
| }
|
|
|
|
|
| -bool ToBooleanStub::Types::UpdateStatus(Handle<Object> object) {
|
| +void ToBooleanStub::Types::TraceTransition(Types to) const {
|
| + #ifdef DEBUG
|
| + if (!FLAG_trace_ic) return;
|
| + char buffer[100];
|
| + NoAllocationStringAllocator allocator(buffer,
|
| + static_cast<unsigned>(sizeof(buffer)));
|
| + StringStream stream(&allocator);
|
| + stream.Add("[ToBooleanIC : ");
|
| + Print(&stream);
|
| + stream.Add("=>");
|
| + to.Print(&stream);
|
| + stream.Add("]\n");
|
| + stream.OutputToStdOut();
|
| + #endif
|
| +}
|
| +
|
| +
|
| +bool ToBooleanStub::Types::Record(Handle<Object> object) {
|
| if (object->IsUndefined()) {
|
| Add(UNDEFINED);
|
| return false;
|
|
|