OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 16292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16303 return static_cast<Type*>(type_raw()); | 16303 return static_cast<Type*>(type_raw()); |
16304 } | 16304 } |
16305 | 16305 |
16306 | 16306 |
16307 void PropertyCell::set_type(Type* type, WriteBarrierMode ignored) { | 16307 void PropertyCell::set_type(Type* type, WriteBarrierMode ignored) { |
16308 ASSERT(IsPropertyCell()); | 16308 ASSERT(IsPropertyCell()); |
16309 set_type_raw(type, ignored); | 16309 set_type_raw(type, ignored); |
16310 } | 16310 } |
16311 | 16311 |
16312 | 16312 |
16313 Type* PropertyCell::UpdatedType(Handle<PropertyCell> cell, | 16313 Handle<Type> PropertyCell::UpdatedType(Handle<PropertyCell> cell, |
16314 Handle<Object> value) { | 16314 Handle<Object> value) { |
16315 Isolate* isolate = cell->GetIsolate(); | 16315 Isolate* isolate = cell->GetIsolate(); |
16316 Handle<Type> old_type(cell->type(), isolate); | 16316 Handle<Type> old_type(cell->type(), isolate); |
16317 // TODO(2803): Do not track ConsString as constant because they cannot be | 16317 // TODO(2803): Do not track ConsString as constant because they cannot be |
16318 // embedded into code. | 16318 // embedded into code. |
16319 Handle<Type> new_type(value->IsConsString() || value->IsTheHole() | 16319 Handle<Type> new_type(value->IsConsString() || value->IsTheHole() |
16320 ? Type::Any() | 16320 ? Type::Any() |
16321 : Type::Constant(value, isolate), isolate); | 16321 : Type::Constant(value, isolate), isolate); |
16322 | 16322 |
16323 if (new_type->Is(old_type)) { | 16323 if (new_type->Is(old_type)) { |
16324 return *old_type; | 16324 return old_type; |
16325 } | 16325 } |
16326 | 16326 |
16327 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 16327 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
16328 isolate, DependentCode::kPropertyCellChangedGroup); | 16328 isolate, DependentCode::kPropertyCellChangedGroup); |
16329 | 16329 |
16330 if (old_type->Is(Type::None()) || old_type->Is(Type::Undefined())) { | 16330 if (old_type->Is(Type::None()) || old_type->Is(Type::Undefined())) { |
16331 return *new_type; | 16331 return new_type; |
16332 } | 16332 } |
16333 | 16333 |
16334 return Type::Any(); | 16334 return handle(Type::Any(), isolate); |
16335 } | 16335 } |
16336 | 16336 |
16337 | 16337 |
16338 void PropertyCell::SetValueInferType(Handle<PropertyCell> cell, | 16338 void PropertyCell::SetValueInferType(Handle<PropertyCell> cell, |
16339 Handle<Object> value) { | 16339 Handle<Object> value) { |
16340 cell->set_value(*value); | 16340 cell->set_value(*value); |
16341 if (!Type::Any()->Is(cell->type())) { | 16341 if (!Type::Any()->Is(cell->type())) { |
16342 Type* new_type = UpdatedType(cell, value); | 16342 Handle<Type> new_type = UpdatedType(cell, value); |
16343 cell->set_type(new_type); | 16343 cell->set_type(*new_type); |
16344 } | 16344 } |
16345 } | 16345 } |
16346 | 16346 |
16347 | 16347 |
16348 void PropertyCell::AddDependentCompilationInfo(CompilationInfo* info) { | 16348 void PropertyCell::AddDependentCompilationInfo(CompilationInfo* info) { |
16349 Handle<DependentCode> dep(dependent_code()); | 16349 Handle<DependentCode> dep(dependent_code()); |
16350 Handle<DependentCode> codes = | 16350 Handle<DependentCode> codes = |
16351 DependentCode::Insert(dep, DependentCode::kPropertyCellChangedGroup, | 16351 DependentCode::Insert(dep, DependentCode::kPropertyCellChangedGroup, |
16352 info->object_wrapper()); | 16352 info->object_wrapper()); |
16353 if (*codes != dependent_code()) set_dependent_code(*codes); | 16353 if (*codes != dependent_code()) set_dependent_code(*codes); |
(...skipping 15 matching lines...) Expand all Loading... |
16369 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16369 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16370 static const char* error_messages_[] = { | 16370 static const char* error_messages_[] = { |
16371 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16371 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16372 }; | 16372 }; |
16373 #undef ERROR_MESSAGES_TEXTS | 16373 #undef ERROR_MESSAGES_TEXTS |
16374 return error_messages_[reason]; | 16374 return error_messages_[reason]; |
16375 } | 16375 } |
16376 | 16376 |
16377 | 16377 |
16378 } } // namespace v8::internal | 16378 } } // namespace v8::internal |
OLD | NEW |