| OLD | NEW |
| 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 1544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1555 | 1555 |
| 1556 int CallOptimization::GetPrototypeDepthOfExpectedType( | 1556 int CallOptimization::GetPrototypeDepthOfExpectedType( |
| 1557 Handle<JSObject> object, | 1557 Handle<JSObject> object, |
| 1558 Handle<JSObject> holder) const { | 1558 Handle<JSObject> holder) const { |
| 1559 ASSERT(is_simple_api_call()); | 1559 ASSERT(is_simple_api_call()); |
| 1560 if (expected_receiver_type_.is_null()) return 0; | 1560 if (expected_receiver_type_.is_null()) return 0; |
| 1561 int depth = 0; | 1561 int depth = 0; |
| 1562 while (!object.is_identical_to(holder)) { | 1562 while (!object.is_identical_to(holder)) { |
| 1563 if (object->IsInstanceOf(*expected_receiver_type_)) return depth; | 1563 if (object->IsInstanceOf(*expected_receiver_type_)) return depth; |
| 1564 object = Handle<JSObject>(JSObject::cast(object->GetPrototype())); | 1564 object = Handle<JSObject>(JSObject::cast(object->GetPrototype())); |
| 1565 if (!object->map()->is_hidden_prototype()) return kInvalidProtoDepth; |
| 1565 ++depth; | 1566 ++depth; |
| 1566 } | 1567 } |
| 1567 if (holder->IsInstanceOf(*expected_receiver_type_)) return depth; | 1568 if (holder->IsInstanceOf(*expected_receiver_type_)) return depth; |
| 1568 return kInvalidProtoDepth; | 1569 return kInvalidProtoDepth; |
| 1569 } | 1570 } |
| 1570 | 1571 |
| 1571 | 1572 |
| 1572 void CallOptimization::Initialize(Handle<JSFunction> function) { | 1573 void CallOptimization::Initialize(Handle<JSFunction> function) { |
| 1573 constant_function_ = Handle<JSFunction>::null(); | 1574 constant_function_ = Handle<JSFunction>::null(); |
| 1574 is_simple_api_call_ = false; | 1575 is_simple_api_call_ = false; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1602 Handle<FunctionTemplateInfo>( | 1603 Handle<FunctionTemplateInfo>( |
| 1603 FunctionTemplateInfo::cast(signature->receiver())); | 1604 FunctionTemplateInfo::cast(signature->receiver())); |
| 1604 } | 1605 } |
| 1605 } | 1606 } |
| 1606 | 1607 |
| 1607 is_simple_api_call_ = true; | 1608 is_simple_api_call_ = true; |
| 1608 } | 1609 } |
| 1609 | 1610 |
| 1610 | 1611 |
| 1611 } } // namespace v8::internal | 1612 } } // namespace v8::internal |
| OLD | NEW |