summaryrefslogtreecommitdiff
path: root/deps/v8/src/compilation-dependencies.cc
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2015-06-19 13:23:56 +0200
committerRod Vagg <rod@vagg.org>2015-08-04 11:56:14 -0700
commit70d1f32f5605465a1a630a64f6f0d35f96c7709d (patch)
tree0a349040a686eafcb0a09943ebc733477dce2781 /deps/v8/src/compilation-dependencies.cc
parent4643b8b6671607a7aff60cbbd0b384dcf2f6959e (diff)
downloadnode-new-70d1f32f5605465a1a630a64f6f0d35f96c7709d.tar.gz
deps: update v8 to 4.4.63.9
Upgrade the bundled V8 and update code in src/ and lib/ to the new API. Notable backwards incompatible changes are the removal of the smalloc module and dropped support for CESU-8 decoding. CESU-8 support can be brought back if necessary by doing UTF-8 decoding ourselves. This commit includes https://codereview.chromium.org/1192973004 to fix a build error on python 2.6 systems. The original commit log follows: Use optparse in js2c.py for python compatibility Without this change, V8 won't build on RHEL/CentOS 6 because the distro python is too old to know about the argparse module. PR-URL: https://github.com/nodejs/io.js/pull/2022 Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Diffstat (limited to 'deps/v8/src/compilation-dependencies.cc')
-rw-r--r--deps/v8/src/compilation-dependencies.cc121
1 files changed, 121 insertions, 0 deletions
diff --git a/deps/v8/src/compilation-dependencies.cc b/deps/v8/src/compilation-dependencies.cc
new file mode 100644
index 0000000000..9ea6a7a878
--- /dev/null
+++ b/deps/v8/src/compilation-dependencies.cc
@@ -0,0 +1,121 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/factory.h"
+#include "src/handles-inl.h"
+#include "src/isolate.h"
+#include "src/objects-inl.h"
+#include "src/zone.h"
+
+#include "src/compilation-dependencies.h"
+
+namespace v8 {
+namespace internal {
+
+DependentCode* CompilationDependencies::Get(Handle<Object> object) {
+ if (object->IsMap()) {
+ return Handle<Map>::cast(object)->dependent_code();
+ } else if (object->IsPropertyCell()) {
+ return Handle<PropertyCell>::cast(object)->dependent_code();
+ } else if (object->IsAllocationSite()) {
+ return Handle<AllocationSite>::cast(object)->dependent_code();
+ }
+ UNREACHABLE();
+ return nullptr;
+}
+
+
+void CompilationDependencies::Set(Handle<Object> object,
+ Handle<DependentCode> dep) {
+ if (object->IsMap()) {
+ Handle<Map>::cast(object)->set_dependent_code(*dep);
+ } else if (object->IsPropertyCell()) {
+ Handle<PropertyCell>::cast(object)->set_dependent_code(*dep);
+ } else if (object->IsAllocationSite()) {
+ Handle<AllocationSite>::cast(object)->set_dependent_code(*dep);
+ } else {
+ UNREACHABLE();
+ }
+}
+
+
+void CompilationDependencies::Insert(DependentCode::DependencyGroup group,
+ Handle<HeapObject> object) {
+ if (groups_[group] == nullptr) {
+ groups_[group] = new (zone_) ZoneList<Handle<HeapObject>>(2, zone_);
+ }
+ groups_[group]->Add(object, zone_);
+
+ if (object_wrapper_.is_null()) {
+ // Allocate the wrapper if necessary.
+ object_wrapper_ =
+ isolate_->factory()->NewForeign(reinterpret_cast<Address>(this));
+ }
+
+ // Get the old dependent code list.
+ Handle<DependentCode> old_dependent_code =
+ Handle<DependentCode>(Get(object), isolate_);
+ Handle<DependentCode> new_dependent_code =
+ DependentCode::InsertCompilationDependencies(old_dependent_code, group,
+ object_wrapper_);
+
+ // Set the new dependent code list if the head of the list changed.
+ if (!new_dependent_code.is_identical_to(old_dependent_code)) {
+ Set(object, new_dependent_code);
+ }
+}
+
+
+void CompilationDependencies::Commit(Handle<Code> code) {
+ if (IsEmpty()) return;
+
+ DCHECK(!object_wrapper_.is_null());
+ Handle<WeakCell> cell = Code::WeakCellFor(code);
+ AllowDeferredHandleDereference get_wrapper;
+ for (int i = 0; i < DependentCode::kGroupCount; i++) {
+ ZoneList<Handle<HeapObject>>* group_objects = groups_[i];
+ if (group_objects == nullptr) continue;
+ DependentCode::DependencyGroup group =
+ static_cast<DependentCode::DependencyGroup>(i);
+ for (int j = 0; j < group_objects->length(); j++) {
+ DependentCode* dependent_code = Get(group_objects->at(j));
+ dependent_code->UpdateToFinishedCode(group, *object_wrapper_, *cell);
+ }
+ groups_[i] = nullptr; // Zone-allocated, no need to delete.
+ }
+}
+
+
+void CompilationDependencies::Rollback() {
+ if (IsEmpty()) return;
+
+ AllowDeferredHandleDereference get_wrapper;
+ // Unregister from all dependent maps if not yet committed.
+ for (int i = 0; i < DependentCode::kGroupCount; i++) {
+ ZoneList<Handle<HeapObject>>* group_objects = groups_[i];
+ if (group_objects == nullptr) continue;
+ DependentCode::DependencyGroup group =
+ static_cast<DependentCode::DependencyGroup>(i);
+ for (int j = 0; j < group_objects->length(); j++) {
+ DependentCode* dependent_code = Get(group_objects->at(j));
+ dependent_code->RemoveCompilationDependencies(group, *object_wrapper_);
+ }
+ groups_[i] = nullptr; // Zone-allocated, no need to delete.
+ }
+}
+
+
+void CompilationDependencies::AssumeTransitionStable(
+ Handle<AllocationSite> site) {
+ // Do nothing if the object doesn't have any useful element transitions left.
+ ElementsKind kind =
+ site->SitePointsToLiteral()
+ ? JSObject::cast(site->transition_info())->GetElementsKind()
+ : site->GetElementsKind();
+ if (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE) {
+ Insert(DependentCode::kAllocationSiteTransitionChangedGroup, site);
+ }
+}
+}
+} // namespace v8::internal