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()
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());
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();
// 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()
}
if (property->key()->IsPropertyName()) {
EmitCallWithIC(expr,
- property->key()->AsLiteral()->handle(),
+ property->key()->AsLiteral()->value(),
RelocInfo::CODE_TARGET);
} else {
EmitKeyedCallWithIC(expr, property->key());
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.
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());
}
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()
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();
}
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;
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.
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;
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)) {
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.
} 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
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));
}
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!
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_;
};
!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;
void FullCodeGenerator::VisitLiteral(Literal* expr) {
Comment cmnt(masm_, "[ Literal");
- context()->Plug(expr->handle());
+ context()->Plug(expr->value());
}
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());
}
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();
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;
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;
}
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());
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);
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()
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());
}
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();
// 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()
}
if (property->key()->IsPropertyName()) {
EmitCallWithIC(expr,
- property->key()->AsLiteral()->handle(),
+ property->key()->AsLiteral()->value(),
RelocInfo::CODE_TARGET);
} else {
EmitKeyedCallWithIC(expr, property->key());
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.
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());
}
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()
// 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() &&
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:
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();
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);
// 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
void PrettyPrinter::VisitLiteral(Literal* node) {
- PrintLiteral(node->handle(), true);
+ PrintLiteral(node->value(), true);
}
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("[");
// TODO(svenpanne) Start with IndentedScope.
void AstPrinter::VisitLiteral(Literal* node) {
- PrintLiteralIndented("LITERAL", node->handle(), true);
+ PrintLiteralIndented("LITERAL", node->value(), true);
}
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());
}
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());
}
}
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()
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());
}
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();
// 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()
}
if (property->key()->IsPropertyName()) {
EmitCallWithIC(expr,
- property->key()->AsLiteral()->handle(),
+ property->key()->AsLiteral()->value(),
RelocInfo::CODE_TARGET);
} else {
EmitKeyedCallWithIC(expr, property->key());
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.
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());
}
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()