v8/src/compilation-dependencies.h
bmeurer 47fb39e4de Revert of [turbofan] Properly handle dictionary maps in the prototype chain. (patchset #1 id:1 of https://codereview.chromium.org/2067423003/ )
Reason for revert:
As discussed offline with Toon, this is not the correct fix here.

Original issue's description:
> [turbofan] Properly handle dictionary maps in the prototype chain.
>
> Dictionary prototypes don't have stable maps, but still don't matter for
> element access. Generalized the JSNativeContextSpecialization a bit to
> handle everything that Crankshaft can handle in this regard.
>
> R=jarin@chromium.org
> BUG=chromium:616709
>
> Committed: https://crrev.com/1c7bdc7f6f4d9512f4982590bd949f265ee9c8c3
> Cr-Commit-Position: refs/heads/master@{#37019}

TBR=jarin@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:616709

Review-Url: https://codereview.chromium.org/2076493002
Cr-Commit-Position: refs/heads/master@{#37029}
2016-06-16 09:17:35 +00:00

73 lines
2.1 KiB
C++

// 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.
#ifndef V8_DEPENDENCIES_H_
#define V8_DEPENDENCIES_H_
#include "src/handles.h"
#include "src/objects.h"
namespace v8 {
namespace internal {
// Collects dependencies for this compilation, e.g. assumptions about
// stable maps, constant globals, etc.
class CompilationDependencies {
public:
CompilationDependencies(Isolate* isolate, Zone* zone)
: isolate_(isolate),
zone_(zone),
object_wrapper_(Handle<Foreign>::null()),
aborted_(false) {
std::fill_n(groups_, DependentCode::kGroupCount, nullptr);
}
void Insert(DependentCode::DependencyGroup group, Handle<HeapObject> handle);
void AssumeInitialMapCantChange(Handle<Map> map) {
Insert(DependentCode::kInitialMapChangedGroup, map);
}
void AssumeFieldType(Handle<Map> map) {
Insert(DependentCode::kFieldTypeGroup, map);
}
void AssumeMapStable(Handle<Map> map);
void AssumePrototypeMapsStable(
Handle<Map> map,
MaybeHandle<JSReceiver> prototype = MaybeHandle<JSReceiver>());
void AssumeMapNotDeprecated(Handle<Map> map);
void AssumePropertyCell(Handle<PropertyCell> cell) {
Insert(DependentCode::kPropertyCellChangedGroup, cell);
}
void AssumeTenuringDecision(Handle<AllocationSite> site) {
Insert(DependentCode::kAllocationSiteTenuringChangedGroup, site);
}
void AssumeTransitionStable(Handle<AllocationSite> site);
void Commit(Handle<Code> code);
void Rollback();
void Abort() { aborted_ = true; }
bool HasAborted() const { return aborted_; }
bool IsEmpty() const {
for (int i = 0; i < DependentCode::kGroupCount; i++) {
if (groups_[i]) return false;
}
return true;
}
private:
Isolate* isolate_;
Zone* zone_;
Handle<Foreign> object_wrapper_;
bool aborted_;
ZoneList<Handle<HeapObject> >* groups_[DependentCode::kGroupCount];
DependentCode* Get(Handle<Object> object);
void Set(Handle<Object> object, Handle<DependentCode> dep);
};
} // namespace internal
} // namespace v8
#endif // V8_DEPENDENCIES_H_