| 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 2701 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2712   for (; descriptor < descriptors; descriptor++) { | 2712   for (; descriptor < descriptors; descriptor++) { | 
| 2713     MaybeObject* maybe_map = new_map->CopyInstallDescriptors( | 2713     MaybeObject* maybe_map = new_map->CopyInstallDescriptors( | 
| 2714         descriptor, new_descriptors); | 2714         descriptor, new_descriptors); | 
| 2715     if (!maybe_map->To(&new_map)) { | 2715     if (!maybe_map->To(&new_map)) { | 
| 2716       // Create a handle for the last created map to ensure it stays alive | 2716       // Create a handle for the last created map to ensure it stays alive | 
| 2717       // during GC. Its descriptor array is too large, but it will be | 2717       // during GC. Its descriptor array is too large, but it will be | 
| 2718       // overwritten during retry anyway. | 2718       // overwritten during retry anyway. | 
| 2719       Handle<Map>(new_map); | 2719       Handle<Map>(new_map); | 
| 2720       return maybe_map; | 2720       return maybe_map; | 
| 2721     } | 2721     } | 
| 2722     new_map->set_migration_target(true); |  | 
| 2723   } | 2722   } | 
| 2724 | 2723 | 
| 2725   new_map->set_owns_descriptors(true); | 2724   new_map->set_owns_descriptors(true); | 
| 2726   return new_map; | 2725   return new_map; | 
| 2727 } | 2726 } | 
| 2728 | 2727 | 
| 2729 | 2728 | 
| 2730 Map* Map::CurrentMapForDeprecated() { | 2729 Map* Map::CurrentMapForDeprecated() { | 
| 2731   DisallowHeapAllocation no_allocation; | 2730   DisallowHeapAllocation no_allocation; | 
| 2732   if (!is_deprecated()) return this; | 2731   if (!is_deprecated()) return this; | 
| (...skipping 3778 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 6511   Map* result; | 6510   Map* result; | 
| 6512   MaybeObject* maybe_result = RawCopy(new_instance_size); | 6511   MaybeObject* maybe_result = RawCopy(new_instance_size); | 
| 6513   if (!maybe_result->To(&result)) return maybe_result; | 6512   if (!maybe_result->To(&result)) return maybe_result; | 
| 6514 | 6513 | 
| 6515   if (mode != CLEAR_INOBJECT_PROPERTIES) { | 6514   if (mode != CLEAR_INOBJECT_PROPERTIES) { | 
| 6516     result->set_inobject_properties(inobject_properties()); | 6515     result->set_inobject_properties(inobject_properties()); | 
| 6517   } | 6516   } | 
| 6518 | 6517 | 
| 6519   result->set_is_shared(sharing == SHARED_NORMALIZED_MAP); | 6518   result->set_is_shared(sharing == SHARED_NORMALIZED_MAP); | 
| 6520   result->set_dictionary_map(true); | 6519   result->set_dictionary_map(true); | 
| 6521   result->set_migration_target(false); |  | 
| 6522 | 6520 | 
| 6523 #ifdef VERIFY_HEAP | 6521 #ifdef VERIFY_HEAP | 
| 6524   if (FLAG_verify_heap && result->is_shared()) { | 6522   if (FLAG_verify_heap && result->is_shared()) { | 
| 6525     result->SharedMapVerify(); | 6523     result->SharedMapVerify(); | 
| 6526   } | 6524   } | 
| 6527 #endif | 6525 #endif | 
| 6528 | 6526 | 
| 6529   return result; | 6527   return result; | 
| 6530 } | 6528 } | 
| 6531 | 6529 | 
| (...skipping 3267 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 9799     // TODO(3025757): In case the recompiled isn't equivalent to the | 9797     // TODO(3025757): In case the recompiled isn't equivalent to the | 
| 9800     // old code, we have to replace it. We should try to avoid this | 9798     // old code, we have to replace it. We should try to avoid this | 
| 9801     // altogether because it flushes valuable type feedback by | 9799     // altogether because it flushes valuable type feedback by | 
| 9802     // effectively resetting all IC state. | 9800     // effectively resetting all IC state. | 
| 9803     ReplaceCode(recompiled); | 9801     ReplaceCode(recompiled); | 
| 9804   } | 9802   } | 
| 9805   ASSERT(has_deoptimization_support()); | 9803   ASSERT(has_deoptimization_support()); | 
| 9806 } | 9804 } | 
| 9807 | 9805 | 
| 9808 | 9806 | 
| 9809 void SharedFunctionInfo::DisableOptimization(BailoutReason reason) { | 9807 void SharedFunctionInfo::DisableOptimization(const char* reason) { | 
| 9810   // Disable optimization for the shared function info and mark the | 9808   // Disable optimization for the shared function info and mark the | 
| 9811   // code as non-optimizable. The marker on the shared function info | 9809   // code as non-optimizable. The marker on the shared function info | 
| 9812   // is there because we flush non-optimized code thereby loosing the | 9810   // is there because we flush non-optimized code thereby loosing the | 
| 9813   // non-optimizable information for the code. When the code is | 9811   // non-optimizable information for the code. When the code is | 
| 9814   // regenerated and set on the shared function info it is marked as | 9812   // regenerated and set on the shared function info it is marked as | 
| 9815   // non-optimizable if optimization is disabled for the shared | 9813   // non-optimizable if optimization is disabled for the shared | 
| 9816   // function info. | 9814   // function info. | 
| 9817   set_optimization_disabled(true); | 9815   set_optimization_disabled(true); | 
| 9818   // Code should be the lazy compilation stub or else unoptimized.  If the | 9816   // Code should be the lazy compilation stub or else unoptimized.  If the | 
| 9819   // latter, disable optimization for the code too. | 9817   // latter, disable optimization for the code too. | 
| 9820   ASSERT(code()->kind() == Code::FUNCTION || code()->kind() == Code::BUILTIN); | 9818   ASSERT(code()->kind() == Code::FUNCTION || code()->kind() == Code::BUILTIN); | 
| 9821   if (code()->kind() == Code::FUNCTION) { | 9819   if (code()->kind() == Code::FUNCTION) { | 
| 9822     code()->set_optimizable(false); | 9820     code()->set_optimizable(false); | 
| 9823   } | 9821   } | 
| 9824   if (FLAG_trace_opt) { | 9822   if (FLAG_trace_opt) { | 
| 9825     PrintF("[disabled optimization for "); | 9823     PrintF("[disabled optimization for "); | 
| 9826     ShortPrint(); | 9824     ShortPrint(); | 
| 9827     PrintF(", reason: %s]\n", GetBailoutReason(reason)); | 9825     PrintF(", reason: %s]\n", reason); | 
| 9828   } | 9826   } | 
| 9829 } | 9827 } | 
| 9830 | 9828 | 
| 9831 | 9829 | 
| 9832 bool SharedFunctionInfo::VerifyBailoutId(BailoutId id) { | 9830 bool SharedFunctionInfo::VerifyBailoutId(BailoutId id) { | 
| 9833   ASSERT(!id.IsNone()); | 9831   ASSERT(!id.IsNone()); | 
| 9834   Code* unoptimized = code(); | 9832   Code* unoptimized = code(); | 
| 9835   DeoptimizationOutputData* data = | 9833   DeoptimizationOutputData* data = | 
| 9836       DeoptimizationOutputData::cast(unoptimized->deoptimization_data()); | 9834       DeoptimizationOutputData::cast(unoptimized->deoptimization_data()); | 
| 9837   unsigned ignore = Deoptimizer::GetOutputInfo(data, id, this); | 9835   unsigned ignore = Deoptimizer::GetOutputInfo(data, id, this); | 
| (...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 10788         PrintF(out, " argc: %d", entry.argument_count()); | 10786         PrintF(out, " argc: %d", entry.argument_count()); | 
| 10789       } | 10787       } | 
| 10790       PrintF(out, "\n"); | 10788       PrintF(out, "\n"); | 
| 10791     } | 10789     } | 
| 10792     PrintF(out, "\n"); | 10790     PrintF(out, "\n"); | 
| 10793   } else if (kind() == FUNCTION) { | 10791   } else if (kind() == FUNCTION) { | 
| 10794     unsigned offset = back_edge_table_offset(); | 10792     unsigned offset = back_edge_table_offset(); | 
| 10795     // If there is no back edge table, the "table start" will be at or after | 10793     // If there is no back edge table, the "table start" will be at or after | 
| 10796     // (due to alignment) the end of the instruction stream. | 10794     // (due to alignment) the end of the instruction stream. | 
| 10797     if (static_cast<int>(offset) < instruction_size()) { | 10795     if (static_cast<int>(offset) < instruction_size()) { | 
| 10798       FullCodeGenerator::BackEdgeTableIterator back_edges(this); | 10796       Address back_edge_cursor = instruction_start() + offset; | 
| 10799 | 10797       uint32_t table_length = Memory::uint32_at(back_edge_cursor); | 
| 10800       PrintF(out, "Back edges (size = %u)\n", back_edges.table_length()); | 10798       PrintF(out, "Back edges (size = %u)\n", table_length); | 
| 10801       PrintF(out, "ast_id  pc_offset  loop_depth\n"); | 10799       PrintF(out, "ast_id  pc_offset  loop_depth\n"); | 
| 10802 | 10800       for (uint32_t i = 0; i < table_length; ++i) { | 
| 10803       for ( ; !back_edges.Done(); back_edges.Next()) { | 10801         uint32_t ast_id = Memory::uint32_at(back_edge_cursor); | 
| 10804         PrintF(out, "%6d  %9u  %10u\n", back_edges.ast_id().ToInt(), | 10802         uint32_t pc_offset = Memory::uint32_at(back_edge_cursor + kIntSize); | 
| 10805                                         back_edges.pc_offset(), | 10803         uint32_t loop_depth = Memory::uint32_at(back_edge_cursor + | 
| 10806                                         back_edges.loop_depth()); | 10804                                                 2 * kIntSize); | 
|  | 10805         PrintF(out, "%6u  %9u  %10u\n", ast_id, pc_offset, loop_depth); | 
|  | 10806         back_edge_cursor += FullCodeGenerator::kBackEdgeEntrySize; | 
| 10807       } | 10807       } | 
| 10808 |  | 
| 10809       PrintF(out, "\n"); | 10808       PrintF(out, "\n"); | 
| 10810     } | 10809     } | 
| 10811 #ifdef OBJECT_PRINT | 10810 #ifdef OBJECT_PRINT | 
| 10812     if (!type_feedback_info()->IsUndefined()) { | 10811     if (!type_feedback_info()->IsUndefined()) { | 
| 10813       TypeFeedbackInfo::cast(type_feedback_info())->TypeFeedbackInfoPrint(out); | 10812       TypeFeedbackInfo::cast(type_feedback_info())->TypeFeedbackInfoPrint(out); | 
| 10814       PrintF(out, "\n"); | 10813       PrintF(out, "\n"); | 
| 10815     } | 10814     } | 
| 10816 #endif | 10815 #endif | 
| 10817   } | 10816   } | 
| 10818 | 10817 | 
| (...skipping 5139 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 15958 | 15957 | 
| 15959 | 15958 | 
| 15960 void PropertyCell::AddDependentCode(Handle<Code> code) { | 15959 void PropertyCell::AddDependentCode(Handle<Code> code) { | 
| 15961   Handle<DependentCode> codes = DependentCode::Insert( | 15960   Handle<DependentCode> codes = DependentCode::Insert( | 
| 15962       Handle<DependentCode>(dependent_code()), | 15961       Handle<DependentCode>(dependent_code()), | 
| 15963       DependentCode::kPropertyCellChangedGroup, code); | 15962       DependentCode::kPropertyCellChangedGroup, code); | 
| 15964   if (*codes != dependent_code()) set_dependent_code(*codes); | 15963   if (*codes != dependent_code()) set_dependent_code(*codes); | 
| 15965 } | 15964 } | 
| 15966 | 15965 | 
| 15967 | 15966 | 
| 15968 const char* GetBailoutReason(BailoutReason reason) { |  | 
| 15969   ASSERT(reason < kLastErrorMessage); |  | 
| 15970 #define ERROR_MESSAGES_TEXTS(C, T) T, |  | 
| 15971   static const char* error_messages_[] = { |  | 
| 15972       ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |  | 
| 15973   }; |  | 
| 15974 #undef ERROR_MESSAGES_TEXTS |  | 
| 15975   return error_messages_[reason]; |  | 
| 15976 } |  | 
| 15977 |  | 
| 15978 |  | 
| 15979 } }  // namespace v8::internal | 15967 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|