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

Side by Side Diff: src/type-info.cc

Issue 97543002: Refactor BinaryOpIC to be able to use different stubs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 *left_type = *right_type = stub.GetInputType(isolate_, map); 403 *left_type = *right_type = stub.GetInputType(isolate_, map);
404 } 404 }
405 } 405 }
406 406
407 407
408 void TypeFeedbackOracle::BinaryType(TypeFeedbackId id, 408 void TypeFeedbackOracle::BinaryType(TypeFeedbackId id,
409 Handle<Type>* left, 409 Handle<Type>* left,
410 Handle<Type>* right, 410 Handle<Type>* right,
411 Handle<Type>* result, 411 Handle<Type>* result,
412 Maybe<int>* fixed_right_arg, 412 Maybe<int>* fixed_right_arg,
413 Token::Value operation) { 413 Token::Value op) {
414 Handle<Object> object = GetInfo(id); 414 Handle<Object> object = GetInfo(id);
415 if (!object->IsCode()) { 415 if (!object->IsCode()) {
416 // For some binary ops we don't have ICs, e.g. Token::COMMA, but for the 416 // For some binary ops we don't have ICs, e.g. Token::COMMA, but for the
417 // operations covered by the BinaryOpStub we should always have them. 417 // operations covered by the BinaryOpIC we should always have them.
418 ASSERT(!(operation >= BinaryOpStub::FIRST_TOKEN && 418 ASSERT(op < BinaryOpIC::State::FIRST_TOKEN ||
419 operation <= BinaryOpStub::LAST_TOKEN)); 419 op > BinaryOpIC::State::LAST_TOKEN);
420 *left = *right = *result = handle(Type::None(), isolate_); 420 *left = *right = *result = handle(Type::None(), isolate_);
421 *fixed_right_arg = Maybe<int>();
421 return; 422 return;
422 } 423 }
423 Handle<Code> code = Handle<Code>::cast(object); 424 Handle<Code> code = Handle<Code>::cast(object);
424 ASSERT(code->is_binary_op_stub()); 425 ASSERT_EQ(Code::BINARY_OP_IC, code->kind());
426 BinaryOpIC::State state(code->extended_extra_ic_state());
427 ASSERT_EQ(op, state.op());
425 428
426 BinaryOpStub stub(code->extended_extra_ic_state()); 429 *left = state.GetLeftType(isolate());
427 430 *right = state.GetRightType(isolate());
428 // Sanity check. 431 *result = state.GetResultType(isolate());
429 ASSERT(stub.operation() == operation); 432 *fixed_right_arg = state.fixed_right_arg();
430
431 *left = stub.GetLeftType(isolate());
432 *right = stub.GetRightType(isolate());
433 *result = stub.GetResultType(isolate());
434 *fixed_right_arg = stub.fixed_right_arg();
435 } 433 }
436 434
437 435
438 Handle<Type> TypeFeedbackOracle::ClauseType(TypeFeedbackId id) { 436 Handle<Type> TypeFeedbackOracle::ClauseType(TypeFeedbackId id) {
439 Handle<Object> info = GetInfo(id); 437 Handle<Object> info = GetInfo(id);
440 Handle<Type> result(Type::None(), isolate_); 438 Handle<Type> result(Type::None(), isolate_);
441 if (info->IsCode() && Handle<Code>::cast(info)->is_compare_ic_stub()) { 439 if (info->IsCode() && Handle<Code>::cast(info)->is_compare_ic_stub()) {
442 Handle<Code> code = Handle<Code>::cast(info); 440 Handle<Code> code = Handle<Code>::cast(info);
443 CompareIC::State state = ICCompareStub::CompareState(code->stub_info()); 441 CompareIC::State state = ICCompareStub::CompareState(code->stub_info());
444 result = CompareIC::StateToType(isolate_, state); 442 result = CompareIC::StateToType(isolate_, state);
445 } 443 }
446 return result; 444 return result;
447 } 445 }
448 446
449 447
450 Handle<Type> TypeFeedbackOracle::CountType(TypeFeedbackId id) { 448 Handle<Type> TypeFeedbackOracle::CountType(TypeFeedbackId id) {
451 Handle<Object> object = GetInfo(id); 449 Handle<Object> object = GetInfo(id);
452 Handle<Type> unknown(Type::None(), isolate_); 450 if (!object->IsCode()) return handle(Type::None(), isolate_);
453 if (!object->IsCode()) return unknown;
454 Handle<Code> code = Handle<Code>::cast(object); 451 Handle<Code> code = Handle<Code>::cast(object);
455 if (!code->is_binary_op_stub()) return unknown; 452 ASSERT_EQ(Code::BINARY_OP_IC, code->kind());
456 453 BinaryOpIC::State state(code->extended_extra_ic_state());
457 BinaryOpStub stub(code->extended_extra_ic_state()); 454 return state.GetLeftType(isolate());
458 return stub.GetLeftType(isolate());
459 } 455 }
460 456
461 457
462 void TypeFeedbackOracle::PropertyReceiverTypes( 458 void TypeFeedbackOracle::PropertyReceiverTypes(
463 TypeFeedbackId id, Handle<String> name, 459 TypeFeedbackId id, Handle<String> name,
464 SmallMapList* receiver_types, bool* is_prototype) { 460 SmallMapList* receiver_types, bool* is_prototype) {
465 receiver_types->Clear(); 461 receiver_types->Clear();
466 FunctionPrototypeStub proto_stub(Code::LOAD_IC); 462 FunctionPrototypeStub proto_stub(Code::LOAD_IC);
467 *is_prototype = LoadIsStub(id, &proto_stub); 463 *is_prototype = LoadIsStub(id, &proto_stub);
468 if (!*is_prototype) { 464 if (!*is_prototype) {
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 if (info.IsUninitialized()) return Representation::None(); 736 if (info.IsUninitialized()) return Representation::None();
741 if (info.IsSmi()) return Representation::Smi(); 737 if (info.IsSmi()) return Representation::Smi();
742 if (info.IsInteger32()) return Representation::Integer32(); 738 if (info.IsInteger32()) return Representation::Integer32();
743 if (info.IsDouble()) return Representation::Double(); 739 if (info.IsDouble()) return Representation::Double();
744 if (info.IsNumber()) return Representation::Double(); 740 if (info.IsNumber()) return Representation::Double();
745 return Representation::Tagged(); 741 return Representation::Tagged();
746 } 742 }
747 743
748 744
749 } } // namespace v8::internal 745 } } // namespace v8::internal
OLDNEW
« src/log.cc ('K') | « src/token.h ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698