v8/src/compilation-dependencies.h
jgruber 2bc0ff6e24 [presubmit] Add include guard check
This check verifies that all .h files in the src/ directory have an
include guard of the form

 #ifndef V8_PATH_TO_FILE_H_
 #define V8_PATH_TO_FILE_H_
 // ...
 #endif  // V8_PATH_TO_FILE_H_

The check can be skipped with a magic comment:

 // PRESUBMIT_INTENTIONALLY_MISSING_INCLUDE_GUARD

Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I0a7b96abec289ad60f64ba8418f1892a6969596d
Reviewed-on: https://chromium-review.googlesource.com/897487
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51079}
2018-02-02 16:59:32 +00:00

75 lines
2.2 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_COMPILATION_DEPENDENCIES_H_
#define V8_COMPILATION_DEPENDENCIES_H_
#include "src/handles.h"
#include "src/objects.h"
#include "src/objects/map.h"
#include "src/zone/zone-containers.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 AssumeFieldOwner(Handle<Map> map) {
Insert(DependentCode::kFieldOwnerGroup, 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_;
ZoneVector<Handle<HeapObject> >* groups_[DependentCode::kGroupCount];
DependentCode* Get(Handle<Object> object) const;
void Set(Handle<Object> object, Handle<DependentCode> dep);
};
} // namespace internal
} // namespace v8
#endif // V8_COMPILATION_DEPENDENCIES_H_