OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <memory> | 9 #include <memory> |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 12102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12113 | 12113 |
12114 Cell* cell = function->feedback_vector_cell(); | 12114 Cell* cell = function->feedback_vector_cell(); |
12115 if (cell == isolate->heap()->undefined_cell()) { | 12115 if (cell == isolate->heap()->undefined_cell()) { |
12116 if (FLAG_trace_strong_rooted_literals) { | 12116 if (FLAG_trace_strong_rooted_literals) { |
12117 PrintF("EnsureLiterals: Installing literals cell in %s %p\n", | 12117 PrintF("EnsureLiterals: Installing literals cell in %s %p\n", |
12118 shared->DebugName()->ToCString().get(), | 12118 shared->DebugName()->ToCString().get(), |
12119 reinterpret_cast<void*>(*function)); | 12119 reinterpret_cast<void*>(*function)); |
12120 } | 12120 } |
12121 // Top level code didn't get it's literals installed. | 12121 // Top level code didn't get it's literals installed. |
12122 Handle<FeedbackVector> feedback_vector = | 12122 Handle<FeedbackVector> feedback_vector = |
12123 FeedbackVector::New(isolate, handle(shared->feedback_metadata())); | 12123 FeedbackVector::New(isolate, shared); |
12124 Handle<Cell> new_cell = isolate->factory()->NewCell(feedback_vector); | 12124 Handle<Cell> new_cell = isolate->factory()->NewCell(feedback_vector); |
12125 function->set_feedback_vector_cell(*new_cell); | 12125 function->set_feedback_vector_cell(*new_cell); |
12126 } else if (!cell->value()->IsFeedbackVector() || | 12126 } else if (!cell->value()->IsFeedbackVector() || |
12127 !function->has_feedback_vector()) { | 12127 !function->has_feedback_vector()) { |
12128 DCHECK(cell != isolate->heap()->undefined_cell()); | 12128 DCHECK(cell != isolate->heap()->undefined_cell()); |
12129 if (FLAG_trace_strong_rooted_literals) { | 12129 if (FLAG_trace_strong_rooted_literals) { |
12130 PrintF("EnsureLiterals: Update literals cell in %s %p\n", | 12130 PrintF("EnsureLiterals: Update literals cell in %s %p\n", |
12131 shared->DebugName()->ToCString().get(), | 12131 shared->DebugName()->ToCString().get(), |
12132 reinterpret_cast<void*>(*function)); | 12132 reinterpret_cast<void*>(*function)); |
12133 } | 12133 } |
12134 Handle<FeedbackVector> feedback_vector = | 12134 Handle<FeedbackVector> feedback_vector = |
12135 FeedbackVector::New(isolate, handle(shared->feedback_metadata())); | 12135 FeedbackVector::New(isolate, shared); |
12136 // Re-get the feedback_vector() value as GC may have occurred. | 12136 // Re-get the feedback_vector() value as GC may have occurred. |
12137 function->feedback_vector_cell()->set_value(*feedback_vector); | 12137 function->feedback_vector_cell()->set_value(*feedback_vector); |
12138 } else { | 12138 } else { |
12139 if (FLAG_trace_strong_rooted_literals) { | 12139 if (FLAG_trace_strong_rooted_literals) { |
12140 PrintF("EnsureLiterals: did nothing for %s %p\n", | 12140 PrintF("EnsureLiterals: did nothing for %s %p\n", |
12141 shared->DebugName()->ToCString().get(), | 12141 shared->DebugName()->ToCString().get(), |
12142 reinterpret_cast<void*>(*function)); | 12142 reinterpret_cast<void*>(*function)); |
12143 } | 12143 } |
12144 } | 12144 } |
12145 | |
12146 // No matter what, ensure some post-conditions. | |
12147 DCHECK(shared->feedback_metadata()->slot_count() != 0 || | |
12148 function->feedback_vector() == | |
12149 shared->GetIsolate()->heap()->empty_feedback_vector()); | |
12150 } | 12145 } |
12151 | 12146 |
12152 static void GetMinInobjectSlack(Map* map, void* data) { | 12147 static void GetMinInobjectSlack(Map* map, void* data) { |
12153 int slack = map->unused_property_fields(); | 12148 int slack = map->unused_property_fields(); |
12154 if (*reinterpret_cast<int*>(data) > slack) { | 12149 if (*reinterpret_cast<int*>(data) > slack) { |
12155 *reinterpret_cast<int*>(data) = slack; | 12150 *reinterpret_cast<int*>(data) = slack; |
12156 } | 12151 } |
12157 } | 12152 } |
12158 | 12153 |
12159 | 12154 |
(...skipping 8048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20208 // depend on this. | 20203 // depend on this. |
20209 return DICTIONARY_ELEMENTS; | 20204 return DICTIONARY_ELEMENTS; |
20210 } | 20205 } |
20211 DCHECK_LE(kind, LAST_ELEMENTS_KIND); | 20206 DCHECK_LE(kind, LAST_ELEMENTS_KIND); |
20212 return kind; | 20207 return kind; |
20213 } | 20208 } |
20214 } | 20209 } |
20215 | 20210 |
20216 } // namespace internal | 20211 } // namespace internal |
20217 } // namespace v8 | 20212 } // namespace v8 |
OLD | NEW |