Rename Literal::handle to Literal::value
Just a completely mechanical change... R=svenpanne@chromium.org BUG= Review URL: https://codereview.chromium.org/17576005 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15280 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
a8a9fa807a
commit
007837365d
@ -1692,10 +1692,10 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
|
||||
ASSERT(!CompileTimeValue::IsCompileTimeValue(property->value()));
|
||||
// Fall through.
|
||||
case ObjectLiteral::Property::COMPUTED:
|
||||
if (key->handle()->IsInternalizedString()) {
|
||||
if (key->value()->IsInternalizedString()) {
|
||||
if (property->emit_store()) {
|
||||
VisitForAccumulatorValue(value);
|
||||
__ mov(r2, Operand(key->handle()));
|
||||
__ mov(r2, Operand(key->value()));
|
||||
__ ldr(r1, MemOperand(sp));
|
||||
Handle<Code> ic = is_classic_mode()
|
||||
? isolate()->builtins()->StoreIC_Initialize()
|
||||
@ -2261,7 +2261,7 @@ void FullCodeGenerator::EmitCreateIteratorResult(bool done) {
|
||||
void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
|
||||
SetSourcePosition(prop->position());
|
||||
Literal* key = prop->key()->AsLiteral();
|
||||
__ mov(r2, Operand(key->handle()));
|
||||
__ mov(r2, Operand(key->value()));
|
||||
// Call load IC. It has arguments receiver and property name r0 and r2.
|
||||
Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
|
||||
CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId());
|
||||
@ -2416,7 +2416,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) {
|
||||
VisitForAccumulatorValue(prop->obj());
|
||||
__ mov(r1, r0);
|
||||
__ pop(r0); // Restore value.
|
||||
__ mov(r2, Operand(prop->key()->AsLiteral()->handle()));
|
||||
__ mov(r2, Operand(prop->key()->AsLiteral()->value()));
|
||||
Handle<Code> ic = is_classic_mode()
|
||||
? isolate()->builtins()->StoreIC_Initialize()
|
||||
: isolate()->builtins()->StoreIC_Initialize_Strict();
|
||||
@ -2545,7 +2545,7 @@ void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
|
||||
|
||||
// Record source code position before IC call.
|
||||
SetSourcePosition(expr->position());
|
||||
__ mov(r2, Operand(prop->key()->AsLiteral()->handle()));
|
||||
__ mov(r2, Operand(prop->key()->AsLiteral()->value()));
|
||||
__ pop(r1);
|
||||
|
||||
Handle<Code> ic = is_classic_mode()
|
||||
@ -2819,7 +2819,7 @@ void FullCodeGenerator::VisitCall(Call* expr) {
|
||||
}
|
||||
if (property->key()->IsPropertyName()) {
|
||||
EmitCallWithIC(expr,
|
||||
property->key()->AsLiteral()->handle(),
|
||||
property->key()->AsLiteral()->value(),
|
||||
RelocInfo::CODE_TARGET);
|
||||
} else {
|
||||
EmitKeyedCallWithIC(expr, property->key());
|
||||
@ -3427,7 +3427,7 @@ void FullCodeGenerator::EmitDateField(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
ASSERT(args->length() == 2);
|
||||
ASSERT_NE(NULL, args->at(1)->AsLiteral());
|
||||
Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->handle()));
|
||||
Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value()));
|
||||
|
||||
VisitForAccumulatorValue(args->at(0)); // Load the object.
|
||||
|
||||
@ -3846,7 +3846,7 @@ void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
ASSERT_EQ(2, args->length());
|
||||
ASSERT_NE(NULL, args->at(0)->AsLiteral());
|
||||
int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->handle()))->value();
|
||||
int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->value()))->value();
|
||||
|
||||
Handle<FixedArray> jsfunction_result_caches(
|
||||
isolate()->native_context()->jsfunction_result_caches());
|
||||
@ -4519,7 +4519,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
||||
}
|
||||
break;
|
||||
case NAMED_PROPERTY: {
|
||||
__ mov(r2, Operand(prop->key()->AsLiteral()->handle()));
|
||||
__ mov(r2, Operand(prop->key()->AsLiteral()->value()));
|
||||
__ pop(r1);
|
||||
Handle<Code> ic = is_classic_mode()
|
||||
? isolate()->builtins()->StoreIC_Initialize()
|
||||
|
36
src/ast.cc
36
src/ast.cc
@ -57,22 +57,22 @@ AST_NODE_LIST(DECL_ACCEPT)
|
||||
|
||||
|
||||
bool Expression::IsSmiLiteral() {
|
||||
return AsLiteral() != NULL && AsLiteral()->handle()->IsSmi();
|
||||
return AsLiteral() != NULL && AsLiteral()->value()->IsSmi();
|
||||
}
|
||||
|
||||
|
||||
bool Expression::IsStringLiteral() {
|
||||
return AsLiteral() != NULL && AsLiteral()->handle()->IsString();
|
||||
return AsLiteral() != NULL && AsLiteral()->value()->IsString();
|
||||
}
|
||||
|
||||
|
||||
bool Expression::IsNullLiteral() {
|
||||
return AsLiteral() != NULL && AsLiteral()->handle()->IsNull();
|
||||
return AsLiteral() != NULL && AsLiteral()->value()->IsNull();
|
||||
}
|
||||
|
||||
|
||||
bool Expression::IsUndefinedLiteral() {
|
||||
return AsLiteral() != NULL && AsLiteral()->handle()->IsUndefined();
|
||||
return AsLiteral() != NULL && AsLiteral()->value()->IsUndefined();
|
||||
}
|
||||
|
||||
|
||||
@ -189,7 +189,7 @@ ObjectLiteralProperty::ObjectLiteralProperty(Literal* key,
|
||||
emit_store_ = true;
|
||||
key_ = key;
|
||||
value_ = value;
|
||||
Object* k = *key->handle();
|
||||
Object* k = *key->value();
|
||||
if (k->IsInternalizedString() &&
|
||||
isolate->heap()->proto_string()->Equals(String::cast(k))) {
|
||||
kind_ = PROTOTYPE;
|
||||
@ -263,7 +263,7 @@ void ObjectLiteral::CalculateEmitStore(Zone* zone) {
|
||||
for (int i = properties()->length() - 1; i >= 0; i--) {
|
||||
ObjectLiteral::Property* property = properties()->at(i);
|
||||
Literal* literal = property->key();
|
||||
if (literal->handle()->IsNull()) continue;
|
||||
if (literal->value()->IsNull()) continue;
|
||||
uint32_t hash = literal->Hash();
|
||||
// If the key of a computed property is in the table, do not emit
|
||||
// a store for the property later.
|
||||
@ -338,7 +338,7 @@ static bool MatchLiteralCompareTypeof(Expression* left,
|
||||
Handle<String>* check) {
|
||||
if (IsTypeof(left) && right->IsStringLiteral() && Token::IsEqualityOp(op)) {
|
||||
*expr = left->AsUnaryOperation()->expression();
|
||||
*check = Handle<String>::cast(right->AsLiteral()->handle());
|
||||
*check = Handle<String>::cast(right->AsLiteral()->value());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -449,8 +449,8 @@ void Property::RecordTypeFeedback(TypeFeedbackOracle* oracle,
|
||||
is_function_prototype_ = true;
|
||||
} else {
|
||||
Literal* lit_key = key()->AsLiteral();
|
||||
ASSERT(lit_key != NULL && lit_key->handle()->IsString());
|
||||
Handle<String> name = Handle<String>::cast(lit_key->handle());
|
||||
ASSERT(lit_key != NULL && lit_key->value()->IsString());
|
||||
Handle<String> name = Handle<String>::cast(lit_key->value());
|
||||
oracle->LoadReceiverTypes(this, name, &receiver_types_);
|
||||
}
|
||||
} else if (oracle->LoadIsBuiltin(this, Builtins::kKeyedLoadIC_String)) {
|
||||
@ -476,8 +476,8 @@ void Assignment::RecordTypeFeedback(TypeFeedbackOracle* oracle,
|
||||
receiver_types_.Clear();
|
||||
if (prop->key()->IsPropertyName()) {
|
||||
Literal* lit_key = prop->key()->AsLiteral();
|
||||
ASSERT(lit_key != NULL && lit_key->handle()->IsString());
|
||||
Handle<String> name = Handle<String>::cast(lit_key->handle());
|
||||
ASSERT(lit_key != NULL && lit_key->value()->IsString());
|
||||
Handle<String> name = Handle<String>::cast(lit_key->value());
|
||||
oracle->StoreReceiverTypes(this, name, &receiver_types_);
|
||||
} else if (is_monomorphic_) {
|
||||
// Record receiver type for monomorphic keyed stores.
|
||||
@ -619,8 +619,8 @@ void Call::RecordTypeFeedback(TypeFeedbackOracle* oracle,
|
||||
} else {
|
||||
// Method call. Specialize for the receiver types seen at runtime.
|
||||
Literal* key = property->key()->AsLiteral();
|
||||
ASSERT(key != NULL && key->handle()->IsString());
|
||||
Handle<String> name = Handle<String>::cast(key->handle());
|
||||
ASSERT(key != NULL && key->value()->IsString());
|
||||
Handle<String> name = Handle<String>::cast(key->value());
|
||||
receiver_types_.Clear();
|
||||
oracle->CallReceiverTypes(this, name, call_kind, &receiver_types_);
|
||||
#ifdef DEBUG
|
||||
@ -1152,18 +1152,18 @@ void AstConstructionVisitor::VisitCallRuntime(CallRuntime* node) {
|
||||
|
||||
|
||||
Handle<String> Literal::ToString() {
|
||||
if (handle_->IsString()) return Handle<String>::cast(handle_);
|
||||
if (value_->IsString()) return Handle<String>::cast(value_);
|
||||
Factory* factory = Isolate::Current()->factory();
|
||||
ASSERT(handle_->IsNumber());
|
||||
ASSERT(value_->IsNumber());
|
||||
char arr[100];
|
||||
Vector<char> buffer(arr, ARRAY_SIZE(arr));
|
||||
const char* str;
|
||||
if (handle_->IsSmi()) {
|
||||
if (value_->IsSmi()) {
|
||||
// Optimization only, the heap number case would subsume this.
|
||||
OS::SNPrintF(buffer, "%d", Smi::cast(*handle_)->value());
|
||||
OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value());
|
||||
str = arr;
|
||||
} else {
|
||||
str = DoubleToCString(handle_->Number(), buffer);
|
||||
str = DoubleToCString(value_->Number(), buffer);
|
||||
}
|
||||
return factory->NewStringFromAscii(CStrVector(str));
|
||||
}
|
||||
|
30
src/ast.h
30
src/ast.h
@ -1312,36 +1312,36 @@ class Literal: public Expression {
|
||||
DECLARE_NODE_TYPE(Literal)
|
||||
|
||||
virtual bool IsPropertyName() {
|
||||
if (handle_->IsInternalizedString()) {
|
||||
if (value_->IsInternalizedString()) {
|
||||
uint32_t ignored;
|
||||
return !String::cast(*handle_)->AsArrayIndex(&ignored);
|
||||
return !String::cast(*value_)->AsArrayIndex(&ignored);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Handle<String> AsPropertyName() {
|
||||
ASSERT(IsPropertyName());
|
||||
return Handle<String>::cast(handle_);
|
||||
return Handle<String>::cast(value_);
|
||||
}
|
||||
|
||||
virtual bool ToBooleanIsTrue() { return handle_->BooleanValue(); }
|
||||
virtual bool ToBooleanIsFalse() { return !handle_->BooleanValue(); }
|
||||
virtual bool ToBooleanIsTrue() { return value_->BooleanValue(); }
|
||||
virtual bool ToBooleanIsFalse() { return !value_->BooleanValue(); }
|
||||
|
||||
// Identity testers.
|
||||
bool IsNull() const {
|
||||
ASSERT(!handle_.is_null());
|
||||
return handle_->IsNull();
|
||||
ASSERT(!value_.is_null());
|
||||
return value_->IsNull();
|
||||
}
|
||||
bool IsTrue() const {
|
||||
ASSERT(!handle_.is_null());
|
||||
return handle_->IsTrue();
|
||||
ASSERT(!value_.is_null());
|
||||
return value_->IsTrue();
|
||||
}
|
||||
bool IsFalse() const {
|
||||
ASSERT(!handle_.is_null());
|
||||
return handle_->IsFalse();
|
||||
ASSERT(!value_.is_null());
|
||||
return value_->IsFalse();
|
||||
}
|
||||
|
||||
Handle<Object> handle() const { return handle_; }
|
||||
Handle<Object> value() const { return value_; }
|
||||
|
||||
// Support for using Literal as a HashMap key. NOTE: Currently, this works
|
||||
// only for string and number literals!
|
||||
@ -1356,14 +1356,14 @@ class Literal: public Expression {
|
||||
TypeFeedbackId LiteralFeedbackId() const { return reuse(id()); }
|
||||
|
||||
protected:
|
||||
Literal(Isolate* isolate, Handle<Object> handle)
|
||||
Literal(Isolate* isolate, Handle<Object> value)
|
||||
: Expression(isolate),
|
||||
handle_(handle) { }
|
||||
value_(value) { }
|
||||
|
||||
private:
|
||||
Handle<String> ToString();
|
||||
|
||||
Handle<Object> handle_;
|
||||
Handle<Object> value_;
|
||||
};
|
||||
|
||||
|
||||
|
@ -178,7 +178,7 @@ bool CodeGenerator::ShouldGenerateLog(Expression* type) {
|
||||
!isolate->cpu_profiler()->is_profiling()) {
|
||||
return false;
|
||||
}
|
||||
Handle<String> name = Handle<String>::cast(type->AsLiteral()->handle());
|
||||
Handle<String> name = Handle<String>::cast(type->AsLiteral()->value());
|
||||
if (FLAG_log_regexp) {
|
||||
if (name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("regexp")))
|
||||
return true;
|
||||
|
@ -1545,7 +1545,7 @@ void FullCodeGenerator::VisitConditional(Conditional* expr) {
|
||||
|
||||
void FullCodeGenerator::VisitLiteral(Literal* expr) {
|
||||
Comment cmnt(masm_, "[ Literal");
|
||||
context()->Plug(expr->handle());
|
||||
context()->Plug(expr->value());
|
||||
}
|
||||
|
||||
|
||||
|
@ -5677,7 +5677,7 @@ void HOptimizedGraphBuilder::VisitLiteral(Literal* expr) {
|
||||
ASSERT(!HasStackOverflow());
|
||||
ASSERT(current_block() != NULL);
|
||||
ASSERT(current_block()->HasPredecessor());
|
||||
HConstant* instr = new(zone()) HConstant(expr->handle());
|
||||
HConstant* instr = new(zone()) HConstant(expr->value());
|
||||
return ast_context()->ReturnInstruction(instr, expr->id());
|
||||
}
|
||||
|
||||
@ -5938,7 +5938,7 @@ void HOptimizedGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
|
||||
ASSERT(!CompileTimeValue::IsCompileTimeValue(value));
|
||||
// Fall through.
|
||||
case ObjectLiteral::Property::COMPUTED:
|
||||
if (key->handle()->IsInternalizedString()) {
|
||||
if (key->value()->IsInternalizedString()) {
|
||||
if (property->emit_store()) {
|
||||
CHECK_ALIVE(VisitForValue(value));
|
||||
HValue* value = Pop();
|
||||
@ -6591,7 +6591,7 @@ void HOptimizedGraphBuilder::BuildStoreNamed(Expression* expr,
|
||||
HValue* object,
|
||||
HValue* value) {
|
||||
Literal* key = prop->key()->AsLiteral();
|
||||
Handle<String> name = Handle<String>::cast(key->handle());
|
||||
Handle<String> name = Handle<String>::cast(key->value());
|
||||
ASSERT(!name.is_null());
|
||||
|
||||
HInstruction* instr = NULL;
|
||||
@ -9506,7 +9506,7 @@ static bool IsClassOfTest(CompareOperation* expr) {
|
||||
if (call == NULL) return false;
|
||||
Literal* literal = expr->right()->AsLiteral();
|
||||
if (literal == NULL) return false;
|
||||
if (!literal->handle()->IsString()) return false;
|
||||
if (!literal->value()->IsString()) return false;
|
||||
if (!call->name()->IsOneByteEqualTo(STATIC_ASCII_VECTOR("_ClassOf"))) {
|
||||
return false;
|
||||
}
|
||||
@ -9752,7 +9752,7 @@ void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
|
||||
CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
|
||||
HValue* value = Pop();
|
||||
Literal* literal = expr->right()->AsLiteral();
|
||||
Handle<String> rhs = Handle<String>::cast(literal->handle());
|
||||
Handle<String> rhs = Handle<String>::cast(literal->value());
|
||||
HClassOfTestAndBranch* instr =
|
||||
new(zone()) HClassOfTestAndBranch(value, rhs);
|
||||
instr->set_position(expr->position());
|
||||
@ -10543,7 +10543,7 @@ void HOptimizedGraphBuilder::GenerateValueOf(CallRuntime* call) {
|
||||
void HOptimizedGraphBuilder::GenerateDateField(CallRuntime* call) {
|
||||
ASSERT(call->arguments()->length() == 2);
|
||||
ASSERT_NE(NULL, call->arguments()->at(1)->AsLiteral());
|
||||
Smi* index = Smi::cast(*(call->arguments()->at(1)->AsLiteral()->handle()));
|
||||
Smi* index = Smi::cast(*(call->arguments()->at(1)->AsLiteral()->value()));
|
||||
CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
|
||||
HValue* date = Pop();
|
||||
HDateField* result = new(zone()) HDateField(date, index);
|
||||
|
@ -1639,10 +1639,10 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
|
||||
ASSERT(!CompileTimeValue::IsCompileTimeValue(value));
|
||||
// Fall through.
|
||||
case ObjectLiteral::Property::COMPUTED:
|
||||
if (key->handle()->IsInternalizedString()) {
|
||||
if (key->value()->IsInternalizedString()) {
|
||||
if (property->emit_store()) {
|
||||
VisitForAccumulatorValue(value);
|
||||
__ mov(ecx, Immediate(key->handle()));
|
||||
__ mov(ecx, Immediate(key->value()));
|
||||
__ mov(edx, Operand(esp, 0));
|
||||
Handle<Code> ic = is_classic_mode()
|
||||
? isolate()->builtins()->StoreIC_Initialize()
|
||||
@ -2221,8 +2221,8 @@ void FullCodeGenerator::EmitCreateIteratorResult(bool done) {
|
||||
void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
|
||||
SetSourcePosition(prop->position());
|
||||
Literal* key = prop->key()->AsLiteral();
|
||||
ASSERT(!key->handle()->IsSmi());
|
||||
__ mov(ecx, Immediate(key->handle()));
|
||||
ASSERT(!key->value()->IsSmi());
|
||||
__ mov(ecx, Immediate(key->value()));
|
||||
Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
|
||||
CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId());
|
||||
}
|
||||
@ -2376,7 +2376,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) {
|
||||
VisitForAccumulatorValue(prop->obj());
|
||||
__ mov(edx, eax);
|
||||
__ pop(eax); // Restore value.
|
||||
__ mov(ecx, prop->key()->AsLiteral()->handle());
|
||||
__ mov(ecx, prop->key()->AsLiteral()->value());
|
||||
Handle<Code> ic = is_classic_mode()
|
||||
? isolate()->builtins()->StoreIC_Initialize()
|
||||
: isolate()->builtins()->StoreIC_Initialize_Strict();
|
||||
@ -2503,7 +2503,7 @@ void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
|
||||
|
||||
// Record source code position before IC call.
|
||||
SetSourcePosition(expr->position());
|
||||
__ mov(ecx, prop->key()->AsLiteral()->handle());
|
||||
__ mov(ecx, prop->key()->AsLiteral()->value());
|
||||
__ pop(edx);
|
||||
Handle<Code> ic = is_classic_mode()
|
||||
? isolate()->builtins()->StoreIC_Initialize()
|
||||
@ -2768,7 +2768,7 @@ void FullCodeGenerator::VisitCall(Call* expr) {
|
||||
}
|
||||
if (property->key()->IsPropertyName()) {
|
||||
EmitCallWithIC(expr,
|
||||
property->key()->AsLiteral()->handle(),
|
||||
property->key()->AsLiteral()->value(),
|
||||
RelocInfo::CODE_TARGET);
|
||||
} else {
|
||||
EmitKeyedCallWithIC(expr, property->key());
|
||||
@ -3386,7 +3386,7 @@ void FullCodeGenerator::EmitDateField(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
ASSERT(args->length() == 2);
|
||||
ASSERT_NE(NULL, args->at(1)->AsLiteral());
|
||||
Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->handle()));
|
||||
Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value()));
|
||||
|
||||
VisitForAccumulatorValue(args->at(0)); // Load the object.
|
||||
|
||||
@ -3815,7 +3815,7 @@ void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) {
|
||||
ASSERT_EQ(2, args->length());
|
||||
|
||||
ASSERT_NE(NULL, args->at(0)->AsLiteral());
|
||||
int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->handle()))->value();
|
||||
int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->value()))->value();
|
||||
|
||||
Handle<FixedArray> jsfunction_result_caches(
|
||||
isolate()->native_context()->jsfunction_result_caches());
|
||||
@ -4527,7 +4527,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
||||
}
|
||||
break;
|
||||
case NAMED_PROPERTY: {
|
||||
__ mov(ecx, prop->key()->AsLiteral()->handle());
|
||||
__ mov(ecx, prop->key()->AsLiteral()->value());
|
||||
__ pop(edx);
|
||||
Handle<Code> ic = is_classic_mode()
|
||||
? isolate()->builtins()->StoreIC_Initialize()
|
||||
|
@ -889,8 +889,8 @@ void* Parser::ParseSourceElements(ZoneList<Statement*>* processor,
|
||||
// Still processing directive prologue?
|
||||
if ((e_stat = stat->AsExpressionStatement()) != NULL &&
|
||||
(literal = e_stat->expression()->AsLiteral()) != NULL &&
|
||||
literal->handle()->IsString()) {
|
||||
Handle<String> directive = Handle<String>::cast(literal->handle());
|
||||
literal->value()->IsString()) {
|
||||
Handle<String> directive = Handle<String>::cast(literal->value());
|
||||
|
||||
// Check "use strict" directive (ES5 14.1).
|
||||
if (top_scope_->is_classic_mode() &&
|
||||
@ -3067,10 +3067,10 @@ Expression* Parser::ParseBinaryExpression(int prec, bool accept_IN, bool* ok) {
|
||||
Expression* y = ParseBinaryExpression(prec1 + 1, accept_IN, CHECK_OK);
|
||||
|
||||
// Compute some expressions involving only number literals.
|
||||
if (x && x->AsLiteral() && x->AsLiteral()->handle()->IsNumber() &&
|
||||
y && y->AsLiteral() && y->AsLiteral()->handle()->IsNumber()) {
|
||||
double x_val = x->AsLiteral()->handle()->Number();
|
||||
double y_val = y->AsLiteral()->handle()->Number();
|
||||
if (x && x->AsLiteral() && x->AsLiteral()->value()->IsNumber() &&
|
||||
y && y->AsLiteral() && y->AsLiteral()->value()->IsNumber()) {
|
||||
double x_val = x->AsLiteral()->value()->Number();
|
||||
double y_val = y->AsLiteral()->value()->Number();
|
||||
|
||||
switch (op) {
|
||||
case Token::ADD:
|
||||
@ -3169,7 +3169,7 @@ Expression* Parser::ParseUnaryExpression(bool* ok) {
|
||||
Expression* expression = ParseUnaryExpression(CHECK_OK);
|
||||
|
||||
if (expression != NULL && (expression->AsLiteral() != NULL)) {
|
||||
Handle<Object> literal = expression->AsLiteral()->handle();
|
||||
Handle<Object> literal = expression->AsLiteral()->value();
|
||||
if (op == Token::NOT) {
|
||||
// Convert the literal to a boolean condition and negate it.
|
||||
bool condition = literal->BooleanValue();
|
||||
@ -3783,7 +3783,7 @@ Handle<FixedArray> CompileTimeValue::GetElements(Handle<FixedArray> value) {
|
||||
|
||||
Handle<Object> Parser::GetBoilerplateValue(Expression* expression) {
|
||||
if (expression->AsLiteral() != NULL) {
|
||||
return expression->AsLiteral()->handle();
|
||||
return expression->AsLiteral()->value();
|
||||
}
|
||||
if (CompileTimeValue::IsCompileTimeValue(expression)) {
|
||||
return CompileTimeValue::GetValue(expression);
|
||||
@ -3896,7 +3896,7 @@ void Parser::BuildObjectLiteralConstantProperties(
|
||||
// Add CONSTANT and COMPUTED properties to boilerplate. Use undefined
|
||||
// value for COMPUTED properties, the real value is filled in at
|
||||
// runtime. The enumeration order is maintained.
|
||||
Handle<Object> key = property->key()->handle();
|
||||
Handle<Object> key = property->key()->value();
|
||||
Handle<Object> value = GetBoilerplateValue(property->value());
|
||||
|
||||
// Ensure objects that may, at any point in time, contain fields with double
|
||||
|
@ -315,7 +315,7 @@ void PrettyPrinter::VisitConditional(Conditional* node) {
|
||||
|
||||
|
||||
void PrettyPrinter::VisitLiteral(Literal* node) {
|
||||
PrintLiteral(node->handle(), true);
|
||||
PrintLiteral(node->value(), true);
|
||||
}
|
||||
|
||||
|
||||
@ -379,11 +379,11 @@ void PrettyPrinter::VisitThrow(Throw* node) {
|
||||
void PrettyPrinter::VisitProperty(Property* node) {
|
||||
Expression* key = node->key();
|
||||
Literal* literal = key->AsLiteral();
|
||||
if (literal != NULL && literal->handle()->IsInternalizedString()) {
|
||||
if (literal != NULL && literal->value()->IsInternalizedString()) {
|
||||
Print("(");
|
||||
Visit(node->obj());
|
||||
Print(").");
|
||||
PrintLiteral(literal->handle(), false);
|
||||
PrintLiteral(literal->value(), false);
|
||||
} else {
|
||||
Visit(node->obj());
|
||||
Print("[");
|
||||
@ -999,7 +999,7 @@ void AstPrinter::VisitConditional(Conditional* node) {
|
||||
|
||||
// TODO(svenpanne) Start with IndentedScope.
|
||||
void AstPrinter::VisitLiteral(Literal* node) {
|
||||
PrintLiteralIndented("LITERAL", node->handle(), true);
|
||||
PrintLiteralIndented("LITERAL", node->value(), true);
|
||||
}
|
||||
|
||||
|
||||
@ -1102,8 +1102,8 @@ void AstPrinter::VisitProperty(Property* node) {
|
||||
IndentedScope indent(this, "PROPERTY");
|
||||
Visit(node->obj());
|
||||
Literal* literal = node->key()->AsLiteral();
|
||||
if (literal != NULL && literal->handle()->IsInternalizedString()) {
|
||||
PrintLiteralIndented("NAME", literal->handle(), false);
|
||||
if (literal != NULL && literal->value()->IsInternalizedString()) {
|
||||
PrintLiteralIndented("NAME", literal->value(), false);
|
||||
} else {
|
||||
PrintIndentedVisit("KEY", node->key());
|
||||
}
|
||||
|
@ -295,7 +295,7 @@ void AstTyper::VisitObjectLiteral(ObjectLiteral* expr) {
|
||||
if ((prop->kind() == ObjectLiteral::Property::MATERIALIZED_LITERAL &&
|
||||
!CompileTimeValue::IsCompileTimeValue(prop->value())) ||
|
||||
prop->kind() == ObjectLiteral::Property::COMPUTED) {
|
||||
if (prop->key()->handle()->IsInternalizedString() && prop->emit_store())
|
||||
if (prop->key()->value()->IsInternalizedString() && prop->emit_store())
|
||||
prop->RecordTypeFeedback(oracle());
|
||||
}
|
||||
}
|
||||
|
@ -1663,10 +1663,10 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
|
||||
ASSERT(!CompileTimeValue::IsCompileTimeValue(value));
|
||||
// Fall through.
|
||||
case ObjectLiteral::Property::COMPUTED:
|
||||
if (key->handle()->IsInternalizedString()) {
|
||||
if (key->value()->IsInternalizedString()) {
|
||||
if (property->emit_store()) {
|
||||
VisitForAccumulatorValue(value);
|
||||
__ Move(rcx, key->handle());
|
||||
__ Move(rcx, key->value());
|
||||
__ movq(rdx, Operand(rsp, 0));
|
||||
Handle<Code> ic = is_classic_mode()
|
||||
? isolate()->builtins()->StoreIC_Initialize()
|
||||
@ -2247,7 +2247,7 @@ void FullCodeGenerator::EmitCreateIteratorResult(bool done) {
|
||||
void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
|
||||
SetSourcePosition(prop->position());
|
||||
Literal* key = prop->key()->AsLiteral();
|
||||
__ Move(rcx, key->handle());
|
||||
__ Move(rcx, key->value());
|
||||
Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
|
||||
CallIC(ic, RelocInfo::CODE_TARGET, prop->PropertyFeedbackId());
|
||||
}
|
||||
@ -2366,7 +2366,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) {
|
||||
VisitForAccumulatorValue(prop->obj());
|
||||
__ movq(rdx, rax);
|
||||
__ pop(rax); // Restore value.
|
||||
__ Move(rcx, prop->key()->AsLiteral()->handle());
|
||||
__ Move(rcx, prop->key()->AsLiteral()->value());
|
||||
Handle<Code> ic = is_classic_mode()
|
||||
? isolate()->builtins()->StoreIC_Initialize()
|
||||
: isolate()->builtins()->StoreIC_Initialize_Strict();
|
||||
@ -2489,7 +2489,7 @@ void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
|
||||
|
||||
// Record source code position before IC call.
|
||||
SetSourcePosition(expr->position());
|
||||
__ Move(rcx, prop->key()->AsLiteral()->handle());
|
||||
__ Move(rcx, prop->key()->AsLiteral()->value());
|
||||
__ pop(rdx);
|
||||
Handle<Code> ic = is_classic_mode()
|
||||
? isolate()->builtins()->StoreIC_Initialize()
|
||||
@ -2749,7 +2749,7 @@ void FullCodeGenerator::VisitCall(Call* expr) {
|
||||
}
|
||||
if (property->key()->IsPropertyName()) {
|
||||
EmitCallWithIC(expr,
|
||||
property->key()->AsLiteral()->handle(),
|
||||
property->key()->AsLiteral()->value(),
|
||||
RelocInfo::CODE_TARGET);
|
||||
} else {
|
||||
EmitKeyedCallWithIC(expr, property->key());
|
||||
@ -3354,7 +3354,7 @@ void FullCodeGenerator::EmitDateField(CallRuntime* expr) {
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
ASSERT(args->length() == 2);
|
||||
ASSERT_NE(NULL, args->at(1)->AsLiteral());
|
||||
Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->handle()));
|
||||
Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value()));
|
||||
|
||||
VisitForAccumulatorValue(args->at(0)); // Load the object.
|
||||
|
||||
@ -3775,7 +3775,7 @@ void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) {
|
||||
ASSERT_EQ(2, args->length());
|
||||
|
||||
ASSERT_NE(NULL, args->at(0)->AsLiteral());
|
||||
int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->handle()))->value();
|
||||
int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->value()))->value();
|
||||
|
||||
Handle<FixedArray> jsfunction_result_caches(
|
||||
isolate()->native_context()->jsfunction_result_caches());
|
||||
@ -4513,7 +4513,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
||||
}
|
||||
break;
|
||||
case NAMED_PROPERTY: {
|
||||
__ Move(rcx, prop->key()->AsLiteral()->handle());
|
||||
__ Move(rcx, prop->key()->AsLiteral()->value());
|
||||
__ pop(rdx);
|
||||
Handle<Code> ic = is_classic_mode()
|
||||
? isolate()->builtins()->StoreIC_Initialize()
|
||||
|
Loading…
Reference in New Issue
Block a user