The serializer state and even the CPU features will be per-Isolate
later. Currently we get away with global state, because mksnapshot
runs single-threaded and has only 1 Isolate, but this will change.
Furthermore, these changes are yet another prerequisite for removing a
catch-22 at initialization time when we try to enable serialization.
This CL is similar in spirit to r20919, BTW.
BUG=359977
LOG=y
R=mstarzinger@chromium.org
Review URL: https://codereview.chromium.org/
250553005
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20963
ce2b1a6d-e550-0410-aec6-
3dcde31c8c00
// -----------------------------------------------------------------------------
// Implementation of PlatformFeatureScope
-PlatformFeatureScope::PlatformFeatureScope(CpuFeature f)
- : old_cross_compile_(CpuFeatures::cross_compile_) {
+PlatformFeatureScope::PlatformFeatureScope(Isolate* isolate, CpuFeature f)
+ : isolate_(isolate), old_cross_compile_(CpuFeatures::cross_compile_) {
// CpuFeatures is a global singleton, therefore this is only safe in
// single threaded code.
ASSERT(Serializer::enabled());
// different CPU.
class PlatformFeatureScope BASE_EMBEDDED {
public:
- explicit PlatformFeatureScope(CpuFeature f);
+ PlatformFeatureScope(Isolate* isolate, CpuFeature f);
~PlatformFeatureScope();
private:
+ Isolate* isolate_;
uint64_t old_cross_compile_;
};
class NoTrackDoubleFieldsForSerializerScope {
public:
- NoTrackDoubleFieldsForSerializerScope() : flag_(FLAG_track_double_fields) {
+ explicit NoTrackDoubleFieldsForSerializerScope(Isolate* isolate)
+ : isolate_(isolate), flag_(FLAG_track_double_fields) {
if (Serializer::enabled()) {
// Disable tracking double fields because heap numbers treated as
// immutable by the serializer.
}
private:
+ Isolate* isolate_;
bool flag_;
};
v8::ExtensionConfiguration* extensions)
: isolate_(isolate),
active_(isolate->bootstrapper()) {
- NoTrackDoubleFieldsForSerializerScope disable_double_tracking_for_serializer;
+ NoTrackDoubleFieldsForSerializerScope disable_scope(isolate);
result_ = Handle<Context>::null();
// If V8 cannot be initialized, just return.
if (!V8::Initialize(NULL)) return;
class BinaryOpICStub : public HydrogenCodeStub {
public:
BinaryOpICStub(Isolate* isolate, Token::Value op, OverwriteMode mode)
- : HydrogenCodeStub(isolate, UNINITIALIZED), state_(op, mode) {}
+ : HydrogenCodeStub(isolate, UNINITIALIZED), state_(isolate, op, mode) {}
BinaryOpICStub(Isolate* isolate, const BinaryOpIC::State& state)
: HydrogenCodeStub(isolate), state_(state) {}
void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) {
if (Serializer::enabled()) {
- PlatformFeatureScope sse2(SSE2);
+ PlatformFeatureScope sse2(masm->isolate(), SSE2);
Generate_NotifyStubFailureHelper(masm, kSaveFPRegs);
} else {
Generate_NotifyStubFailureHelper(masm, kSaveFPRegs);
ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate);
CreateAllocationSiteStub::GenerateAheadOfTime(isolate);
if (Serializer::enabled()) {
- PlatformFeatureScope sse2(SSE2);
+ PlatformFeatureScope sse2(isolate, SSE2);
BinaryOpICStub::GenerateAheadOfTime(isolate);
BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate);
} else {
}
-BinaryOpIC::State::State(ExtraICState extra_ic_state) {
+BinaryOpIC::State::State(Isolate* isolate, ExtraICState extra_ic_state)
+ : isolate_(isolate) {
// We don't deserialize the SSE2 Field, since this is only used to be able
// to include SSE2 as well as non-SSE2 versions in the snapshot. For code
// generation we always want it to reflect the current state.
// Generated list of commonly used stubs
#define GENERATE(op, left_kind, right_kind, result_kind, mode) \
do { \
- State state(op, mode); \
+ State state(isolate, op, mode); \
state.left_kind_ = left_kind; \
state.fixed_right_arg_.has_value = false; \
state.right_kind_ = right_kind; \
#undef GENERATE
#define GENERATE(op, left_kind, fixed_right_arg_value, result_kind, mode) \
do { \
- State state(op, mode); \
+ State state(isolate, op, mode); \
state.left_kind_ = left_kind; \
state.fixed_right_arg_.has_value = true; \
state.fixed_right_arg_.value = fixed_right_arg_value; \
Handle<AllocationSite> allocation_site,
Handle<Object> left,
Handle<Object> right) {
- State state(target()->extra_ic_state());
+ State state(isolate(), target()->extra_ic_state());
// Compute the actual result using the builtin for the binary operation.
Object* builtin = isolate()->js_builtins_object()->javascript_builtin(
// update the state of this very IC, so we must update the stored state.
UpdateTarget();
// Compute the new state.
- State old_state(target()->extra_ic_state());
+ State old_state(isolate(), target()->extra_ic_state());
state.Update(left, right, result);
// Check if we have a string operation here.
public:
class State V8_FINAL BASE_EMBEDDED {
public:
- explicit State(ExtraICState extra_ic_state);
+ State(Isolate* isolate, ExtraICState extra_ic_state);
- State(Token::Value op, OverwriteMode mode)
+ State(Isolate* isolate, Token::Value op, OverwriteMode mode)
: op_(op), mode_(mode), left_kind_(NONE), right_kind_(NONE),
- result_kind_(NONE) {
+ result_kind_(NONE), isolate_(isolate) {
ASSERT_LE(FIRST_TOKEN, op);
ASSERT_LE(op, LAST_TOKEN);
}
Handle<Object> right,
Handle<Object> result);
+ Isolate* isolate() const { return isolate_; }
+
private:
enum Kind { NONE, SMI, INT32, NUMBER, STRING, GENERIC };
Kind right_kind_;
Kind result_kind_;
Maybe<int> fixed_right_arg_;
+ Isolate* isolate_;
};
explicit BinaryOpIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) { }
}
Handle<Code> code = Handle<Code>::cast(object);
ASSERT_EQ(Code::BINARY_OP_IC, code->kind());
- BinaryOpIC::State state(code->extra_ic_state());
+ BinaryOpIC::State state(isolate(), code->extra_ic_state());
ASSERT_EQ(op, state.op());
*left = state.GetLeftType(zone());
if (!object->IsCode()) return Type::None(zone());
Handle<Code> code = Handle<Code>::cast(object);
ASSERT_EQ(Code::BINARY_OP_IC, code->kind());
- BinaryOpIC::State state(code->extra_ic_state());
+ BinaryOpIC::State state(isolate(), code->extra_ic_state());
return state.GetLeftType(zone());
}