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

Side by Side Diff: src/objects.cc

Issue 28783002: Handlify PropertyCell::SetValueInferType and friends. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Andreas Rossberg. Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.h ('k') | src/stub-cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 16272 matching lines...) Expand 10 before | Expand all | Expand 10 after
16283 return static_cast<Type*>(type_raw()); 16283 return static_cast<Type*>(type_raw());
16284 } 16284 }
16285 16285
16286 16286
16287 void PropertyCell::set_type(Type* type, WriteBarrierMode ignored) { 16287 void PropertyCell::set_type(Type* type, WriteBarrierMode ignored) {
16288 ASSERT(IsPropertyCell()); 16288 ASSERT(IsPropertyCell());
16289 set_type_raw(type, ignored); 16289 set_type_raw(type, ignored);
16290 } 16290 }
16291 16291
16292 16292
16293 Type* PropertyCell::UpdateType(Handle<PropertyCell> cell, 16293 Type* PropertyCell::UpdatedType(Handle<PropertyCell> cell,
16294 Handle<Object> value) { 16294 Handle<Object> value) {
16295 Isolate* isolate = cell->GetIsolate(); 16295 Isolate* isolate = cell->GetIsolate();
16296 Handle<Type> old_type(cell->type(), isolate); 16296 Handle<Type> old_type(cell->type(), isolate);
16297 // TODO(2803): Do not track ConsString as constant because they cannot be 16297 // TODO(2803): Do not track ConsString as constant because they cannot be
16298 // embedded into code. 16298 // embedded into code.
16299 Handle<Type> new_type(value->IsConsString() || value->IsTheHole() 16299 Handle<Type> new_type(value->IsConsString() || value->IsTheHole()
16300 ? Type::Any() 16300 ? Type::Any()
16301 : Type::Constant(value, isolate), isolate); 16301 : Type::Constant(value, isolate), isolate);
16302 16302
16303 if (new_type->Is(old_type)) { 16303 if (new_type->Is(old_type)) {
16304 return *old_type; 16304 return *old_type;
16305 } 16305 }
16306 16306
16307 cell->dependent_code()->DeoptimizeDependentCodeGroup( 16307 cell->dependent_code()->DeoptimizeDependentCodeGroup(
16308 isolate, DependentCode::kPropertyCellChangedGroup); 16308 isolate, DependentCode::kPropertyCellChangedGroup);
16309 16309
16310 if (old_type->Is(Type::None()) || old_type->Is(Type::Undefined())) { 16310 if (old_type->Is(Type::None()) || old_type->Is(Type::Undefined())) {
16311 return *new_type; 16311 return *new_type;
16312 } 16312 }
16313 16313
16314 return Type::Any(); 16314 return Type::Any();
16315 } 16315 }
16316 16316
16317 16317
16318 void PropertyCell::SetValueInferType(Handle<PropertyCell> cell, 16318 void PropertyCell::SetValueInferType(Handle<PropertyCell> cell,
16319 Handle<Object> value, 16319 Handle<Object> value) {
16320 WriteBarrierMode mode) { 16320 cell->set_value(*value);
16321 CALL_HEAP_FUNCTION_VOID(cell->GetIsolate(), 16321 if (!Type::Any()->Is(cell->type())) {
16322 cell->SetValueInferType(*value, mode)); 16322 Type* new_type = UpdatedType(cell, value);
16323 cell->set_type(new_type);
16324 }
16323 } 16325 }
16324 16326
16325 16327
16326 MaybeObject* PropertyCell::SetValueInferType(Object* value,
16327 WriteBarrierMode ignored) {
16328 set_value(value, ignored);
16329 if (!Type::Any()->Is(type())) {
16330 IdempotentPointerToHandleCodeTrampoline trampoline(GetIsolate());
16331 MaybeObject* maybe_type = trampoline.CallWithReturnValue(
16332 &PropertyCell::UpdateType,
16333 Handle<PropertyCell>(this),
16334 Handle<Object>(value, GetIsolate()));
16335 Type* new_type = NULL;
16336 if (!maybe_type->To(&new_type)) return maybe_type;
16337 set_type(new_type);
16338 }
16339 return value;
16340 }
16341
16342
16343 void PropertyCell::AddDependentCompilationInfo(CompilationInfo* info) { 16328 void PropertyCell::AddDependentCompilationInfo(CompilationInfo* info) {
16344 Handle<DependentCode> dep(dependent_code()); 16329 Handle<DependentCode> dep(dependent_code());
16345 Handle<DependentCode> codes = 16330 Handle<DependentCode> codes =
16346 DependentCode::Insert(dep, DependentCode::kPropertyCellChangedGroup, 16331 DependentCode::Insert(dep, DependentCode::kPropertyCellChangedGroup,
16347 info->object_wrapper()); 16332 info->object_wrapper());
16348 if (*codes != dependent_code()) set_dependent_code(*codes); 16333 if (*codes != dependent_code()) set_dependent_code(*codes);
16349 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( 16334 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add(
16350 Handle<HeapObject>(this), info->zone()); 16335 Handle<HeapObject>(this), info->zone());
16351 } 16336 }
16352 16337
(...skipping 11 matching lines...) Expand all
16364 #define ERROR_MESSAGES_TEXTS(C, T) T, 16349 #define ERROR_MESSAGES_TEXTS(C, T) T,
16365 static const char* error_messages_[] = { 16350 static const char* error_messages_[] = {
16366 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16351 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16367 }; 16352 };
16368 #undef ERROR_MESSAGES_TEXTS 16353 #undef ERROR_MESSAGES_TEXTS
16369 return error_messages_[reason]; 16354 return error_messages_[reason];
16370 } 16355 }
16371 16356
16372 16357
16373 } } // namespace v8::internal 16358 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/stub-cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698