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

Unified Diff: src/property.cc

Issue 167303005: Track field types. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Support transitions in LookupResult. Created 6 years, 9 months 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
Index: src/property.cc
diff --git a/src/property.cc b/src/property.cc
index 2f72eec48ec6626dd06bde01efc7007920d92d9e..bc193b31a8d769f334e33cad479ac0ed345a812c 100644
--- a/src/property.cc
+++ b/src/property.cc
@@ -25,12 +25,20 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include "v8.h"
+#include "types.h"
namespace v8 {
namespace internal {
+bool LookupResult::CanHoldValue(Handle<Object> value) const {
+ if (IsNormal()) return true;
+ if (!value->FitsRepresentation(details_.representation())) return false;
+ if (!IsField() && !IsTransition()) return true;
+ return HeapType::OfCurrently(value, isolate())->IsCurrently(GetFieldType());
+}
+
+
void LookupResult::Iterate(ObjectVisitor* visitor) {
LookupResult* current = this; // Could be NULL.
while (current != NULL) {
@@ -119,4 +127,30 @@ void Descriptor::Print(FILE* out) {
#endif
+HeapType* LookupResult::GetFieldTypeFromMap(Map* map) const {
+ ASSERT(IsFound());
+ ASSERT(IsField() || IsTransition());
+ return HeapType::cast(GetValueFromMap(map));
+}
+
+
+FieldDescriptor::FieldDescriptor(Name* key,
+ int field_index,
+ PropertyAttributes attributes,
+ Representation representation)
+ : Descriptor(key, HeapType::Any(), attributes, FIELD,
+ representation, field_index) {
+}
+
+
+FieldDescriptor::FieldDescriptor(Name* key,
+ int field_index,
+ HeapType* field_type,
+ PropertyAttributes attributes,
+ Representation representation)
+ : Descriptor(key, field_type, attributes, FIELD,
+ representation, field_index) {
+}
+
+
} } // namespace v8::internal
« src/property.h ('K') | « src/property.h ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698