Commit 1cee6bfe authored by Adam Klein's avatar Adam Klein Committed by Commit Bot

[cleanup] Move narrowly-used (and delete unused) globals.h types

Also delete a bit of dead code depending on dead types.

Change-Id: I6cfc7e2f6c8fd006bd0de054bfc3e9f725996741
Reviewed-on: https://chromium-review.googlesource.com/923083Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51403}
parent f2cdf9a8
......@@ -1993,41 +1993,6 @@ int TurboAssembler::CallSize(Handle<Code> code, RelocInfo::Mode rmode) {
: kCallSizeWithRelocation;
}
void MacroAssembler::JumpIfHeapNumber(Register object, Label* on_heap_number,
SmiCheckType smi_check_type) {
Label on_not_heap_number;
if (smi_check_type == DO_SMI_CHECK) {
JumpIfSmi(object, &on_not_heap_number);
}
AssertNotSmi(object);
UseScratchRegisterScope temps(this);
Register temp = temps.AcquireX();
Ldr(temp, FieldMemOperand(object, HeapObject::kMapOffset));
JumpIfRoot(temp, Heap::kHeapNumberMapRootIndex, on_heap_number);
Bind(&on_not_heap_number);
}
void MacroAssembler::JumpIfNotHeapNumber(Register object,
Label* on_not_heap_number,
SmiCheckType smi_check_type) {
if (smi_check_type == DO_SMI_CHECK) {
JumpIfSmi(object, on_not_heap_number);
}
AssertNotSmi(object);
UseScratchRegisterScope temps(this);
Register temp = temps.AcquireX();
Ldr(temp, FieldMemOperand(object, HeapObject::kMapOffset));
JumpIfNotRoot(temp, Heap::kHeapNumberMapRootIndex, on_not_heap_number);
}
void MacroAssembler::TryRepresentDoubleAsInt(Register as_int, VRegister value,
VRegister scratch_d,
Label* on_successful_conversion,
......
......@@ -1727,11 +1727,6 @@ class MacroAssembler : public TurboAssembler {
// via --debug-code.
void AssertUndefinedOrAllocationSite(Register object);
void JumpIfHeapNumber(Register object, Label* on_heap_number,
SmiCheckType smi_check_type = DONT_DO_SMI_CHECK);
void JumpIfNotHeapNumber(Register object, Label* on_not_heap_number,
SmiCheckType smi_check_type = DONT_DO_SMI_CHECK);
// Try to represent a double as a signed 64-bit int.
// This succeeds if the result compares equal to the input, so inputs of -0.0
// are represented as 0 and handled as a success.
......
......@@ -1475,6 +1475,7 @@ class ArrayLiteral final : public AggregateLiteral {
ZoneList<Expression*>* values_;
};
enum class HoleCheckMode { kRequired, kElided };
class VariableProxy final : public Expression {
public:
......
......@@ -23,6 +23,8 @@ class Node;
// out-of-line data associated with each node.
typedef uint32_t NodeId;
// Possible outcomes for decisions.
enum class Decision : uint8_t { kUnknown, kTrue, kFalse };
// Represents the result of trying to reduce a node in the graph.
class Reduction final {
......
......@@ -25,6 +25,8 @@ class JSOperatorBuilder;
class SimplifiedOperatorBuilder;
class TypeCache;
enum Signedness { kSigned, kUnsigned };
// Lowers JS-level operators to simplified operators based on types.
class V8_EXPORT_PRIVATE JSTypedLowering final
: public NON_EXPORTED_BASE(AdvancedReducer) {
......
......@@ -1225,11 +1225,6 @@ Handle<Foreign> Factory::NewForeign(Address addr, PretenureFlag pretenure) {
}
Handle<Foreign> Factory::NewForeign(const AccessorDescriptor* desc) {
return NewForeign((Address) desc, TENURED);
}
Handle<ByteArray> Factory::NewByteArray(int length, PretenureFlag pretenure) {
DCHECK_LE(0, length);
CALL_HEAP_FUNCTION(
......
......@@ -401,10 +401,6 @@ class V8_EXPORT_PRIVATE Factory final {
Handle<Foreign> NewForeign(Address addr,
PretenureFlag pretenure = NOT_TENURED);
// Allocate a new foreign object. The foreign is pretenured (allocated
// directly in the old generation).
Handle<Foreign> NewForeign(const AccessorDescriptor* foreign);
Handle<ByteArray> NewByteArray(int length,
PretenureFlag pretenure = NOT_TENURED);
......
......@@ -539,25 +539,6 @@ enum AllocationAlignment { kWordAligned, kDoubleAligned, kDoubleUnaligned };
enum class AccessMode { ATOMIC, NON_ATOMIC };
// Possible outcomes for decisions.
enum class Decision : uint8_t { kUnknown, kTrue, kFalse };
inline size_t hash_value(Decision decision) {
return static_cast<uint8_t>(decision);
}
inline std::ostream& operator<<(std::ostream& os, Decision decision) {
switch (decision) {
case Decision::kUnknown:
return os << "Unknown";
case Decision::kTrue:
return os << "True";
case Decision::kFalse:
return os << "False";
}
UNREACHABLE();
}
// Supported write barrier modes.
enum WriteBarrierKind : uint8_t {
kNoWriteBarrier,
......@@ -629,9 +610,6 @@ enum NativesFlag {
INSPECTOR_CODE
};
// JavaScript defines two kinds of 'nil'.
enum NilValue { kNullValue, kUndefinedValue };
// ParseRestriction is used to restrict the set of valid statements in a
// unit of compilation. Restriction violations cause a syntax error.
enum ParseRestriction {
......@@ -748,15 +726,6 @@ constexpr int kIeeeDoubleMantissaWordOffset = 4;
constexpr int kIeeeDoubleExponentWordOffset = 0;
#endif
// AccessorCallback
struct AccessorDescriptor {
Object* (*getter)(Isolate* isolate, Object* object, void* data);
Object* (*setter)(
Isolate* isolate, JSObject* object, Object* value, void* data);
void* data;
};
// -----------------------------------------------------------------------------
// Macros
......@@ -888,13 +857,6 @@ inline std::ostream& operator<<(std::ostream& os, CreateArgumentsType type) {
UNREACHABLE();
}
// Used to specify if a macro instruction must perform a smi check on tagged
// values.
enum SmiCheckType {
DONT_DO_SMI_CHECK,
DO_SMI_CHECK
};
enum ScopeType : uint8_t {
EVAL_SCOPE, // The top-level scope for an eval source.
FUNCTION_SCOPE, // The top-level scope for a function.
......@@ -1059,22 +1021,11 @@ enum VariableLocation : uint8_t {
// immediately initialized upon creation (kCreatedInitialized).
enum InitializationFlag : uint8_t { kNeedsInitialization, kCreatedInitialized };
enum class HoleCheckMode { kRequired, kElided };
enum MaybeAssignedFlag : uint8_t { kNotAssigned, kMaybeAssigned };
// Serialized in PreparseData, so numeric values should not be changed.
enum ParseErrorType { kSyntaxError = 0, kReferenceError = 1 };
enum MinusZeroMode {
TREAT_MINUS_ZERO_AS_ZERO,
FAIL_ON_MINUS_ZERO
};
enum Signedness { kSigned, kUnsigned };
enum FunctionKind : uint16_t {
kNormalFunction = 0,
kArrowFunction = 1 << 0,
......
......@@ -163,7 +163,6 @@ void MathPowStub::Generate(MacroAssembler* masm) {
if (exponent_type() != INTEGER) {
Label fast_power, try_arithmetic_simplification;
__ DoubleToI(exponent, double_exponent, double_scratch,
TREAT_MINUS_ZERO_AS_ZERO, &try_arithmetic_simplification,
&try_arithmetic_simplification,
&try_arithmetic_simplification);
__ jmp(&int_exponent);
......
......@@ -184,30 +184,14 @@ void TurboAssembler::SlowTruncateToIDelayed(Zone* zone, Register result_reg) {
}
void MacroAssembler::DoubleToI(Register result_reg, XMMRegister input_reg,
XMMRegister scratch,
MinusZeroMode minus_zero_mode,
Label* lost_precision, Label* is_nan,
Label* minus_zero, Label::Distance dst) {
XMMRegister scratch, Label* lost_precision,
Label* is_nan, Label::Distance dst) {
DCHECK(input_reg != scratch);
cvttsd2si(result_reg, Operand(input_reg));
Cvtsi2sd(scratch, Operand(result_reg));
ucomisd(scratch, input_reg);
j(not_equal, lost_precision, dst);
j(parity_even, is_nan, dst);
if (minus_zero_mode == FAIL_ON_MINUS_ZERO) {
Label done;
// The integer converted back is equal to the original. We
// only have to test if we got -0 as an input.
test(result_reg, Operand(result_reg));
j(not_zero, &done, Label::kNear);
movmskpd(result_reg, input_reg);
// Bit 0 contains the sign of the double in input_reg.
// If input was positive, we are ok and return 0, otherwise
// jump to minus_zero.
and_(result_reg, 1);
j(not_zero, minus_zero, dst);
bind(&done);
}
}
void TurboAssembler::LoadUint32(XMMRegister dst, const Operand& src) {
......
......@@ -478,8 +478,7 @@ class MacroAssembler : public TurboAssembler {
void CmpInstanceType(Register map, InstanceType type);
void DoubleToI(Register result_reg, XMMRegister input_reg,
XMMRegister scratch, MinusZeroMode minus_zero_mode,
Label* lost_precision, Label* is_nan, Label* minus_zero,
XMMRegister scratch, Label* lost_precision, Label* is_nan,
Label::Distance dst = Label::kFar);
// Smi tagging support.
......
......@@ -354,6 +354,9 @@ class V8_EXPORT_PRIVATE BytecodeArrayBuilder final {
// the key to be deleted and the register contains a reference to the object.
BytecodeArrayBuilder& Delete(Register object, LanguageMode language_mode);
// JavaScript defines two kinds of 'nil'.
enum NilValue { kNullValue, kUndefinedValue };
// Tests.
BytecodeArrayBuilder& CompareOperation(Token::Value op, Register reg,
int feedback_slot);
......
......@@ -3896,7 +3896,8 @@ void BytecodeGenerator::VisitNaryOperation(NaryOperation* expr) {
}
}
void BytecodeGenerator::BuildLiteralCompareNil(Token::Value op, NilValue nil) {
void BytecodeGenerator::BuildLiteralCompareNil(
Token::Value op, BytecodeArrayBuilder::NilValue nil) {
if (execution_result()->IsTest()) {
TestResultScope* test_result = execution_result()->AsTest();
switch (test_result->fallthrough()) {
......@@ -3935,11 +3936,11 @@ void BytecodeGenerator::VisitCompareOperation(CompareOperation* expr) {
} else if (expr->IsLiteralCompareUndefined(&sub_expr)) {
VisitForAccumulatorValue(sub_expr);
builder()->SetExpressionPosition(expr);
BuildLiteralCompareNil(expr->op(), kUndefinedValue);
BuildLiteralCompareNil(expr->op(), BytecodeArrayBuilder::kUndefinedValue);
} else if (expr->IsLiteralCompareNull(&sub_expr)) {
VisitForAccumulatorValue(sub_expr);
builder()->SetExpressionPosition(expr);
BuildLiteralCompareNil(expr->op(), kNullValue);
BuildLiteralCompareNil(expr->op(), BytecodeArrayBuilder::kNullValue);
} else {
Register lhs = VisitForRegisterValue(expr->left());
VisitForAccumulatorValue(expr->right());
......
......@@ -127,7 +127,8 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> {
void BuildVariableAssignment(
Variable* variable, Token::Value op, HoleCheckMode hole_check_mode,
LookupHoistingMode lookup_hoisting_mode = LookupHoistingMode::kNormal);
void BuildLiteralCompareNil(Token::Value compare_op, NilValue nil);
void BuildLiteralCompareNil(Token::Value compare_op,
BytecodeArrayBuilder::NilValue nil);
void BuildReturn(int source_position = kNoSourcePosition);
void BuildAsyncReturn(int source_position = kNoSourcePosition);
void BuildAsyncGeneratorReturn();
......
......@@ -135,7 +135,6 @@ void MathPowStub::Generate(MacroAssembler* masm) {
Label fast_power, try_arithmetic_simplification;
// Detect integer exponents stored as double.
__ DoubleToI(exponent, double_exponent, double_scratch,
TREAT_MINUS_ZERO_AS_ZERO, &try_arithmetic_simplification,
&try_arithmetic_simplification,
&try_arithmetic_simplification);
__ jmp(&int_exponent);
......
......@@ -2039,29 +2039,13 @@ void TurboAssembler::SlowTruncateToIDelayed(Zone* zone, Register result_reg) {
}
void MacroAssembler::DoubleToI(Register result_reg, XMMRegister input_reg,
XMMRegister scratch,
MinusZeroMode minus_zero_mode,
Label* lost_precision, Label* is_nan,
Label* minus_zero, Label::Distance dst) {
XMMRegister scratch, Label* lost_precision,
Label* is_nan, Label::Distance dst) {
Cvttsd2si(result_reg, input_reg);
Cvtlsi2sd(kScratchDoubleReg, result_reg);
Ucomisd(kScratchDoubleReg, input_reg);
j(not_equal, lost_precision, dst);
j(parity_even, is_nan, dst); // NaN.
if (minus_zero_mode == FAIL_ON_MINUS_ZERO) {
Label done;
// The integer converted back is equal to the original. We
// only have to test if we got -0 as an input.
testl(result_reg, result_reg);
j(not_zero, &done, Label::kNear);
Movmskpd(result_reg, input_reg);
// Bit 0 contains the sign of the double in input_reg.
// If input was positive, we are ok and return 0, otherwise
// jump to minus_zero.
andl(result_reg, Immediate(1));
j(not_zero, minus_zero, dst);
bind(&done);
}
}
......
......@@ -814,8 +814,7 @@ class MacroAssembler : public TurboAssembler {
void CmpInstanceType(Register map, InstanceType type);
void DoubleToI(Register result_reg, XMMRegister input_reg,
XMMRegister scratch, MinusZeroMode minus_zero_mode,
Label* lost_precision, Label* is_nan, Label* minus_zero,
XMMRegister scratch, Label* lost_precision, Label* is_nan,
Label::Distance dst = Label::kFar);
template<typename Field>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment