DisallowHeapAllocation no_allocation;
HandleScope scope(isolate);
Object* object = *Utils::OpenHandle(*info.This());
- Object* res = Script::cast(JSValue::cast(object)->value())->column_offset();
+ Object* res = Smi::FromInt(
+ Script::cast(JSValue::cast(object)->value())->column_offset());
info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(res, isolate)));
}
DisallowHeapAllocation no_allocation;
HandleScope scope(isolate);
Object* object = *Utils::OpenHandle(*info.This());
- Object* id = Script::cast(JSValue::cast(object)->value())->id();
+ Object* id = Smi::FromInt(Script::cast(JSValue::cast(object)->value())->id());
info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(id, isolate)));
}
DisallowHeapAllocation no_allocation;
HandleScope scope(isolate);
Object* object = *Utils::OpenHandle(*info.This());
- Object* res = Script::cast(JSValue::cast(object)->value())->line_offset();
+ Object* res =
+ Smi::FromInt(Script::cast(JSValue::cast(object)->value())->line_offset());
info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(res, isolate)));
}
DisallowHeapAllocation no_allocation;
HandleScope scope(isolate);
Object* object = *Utils::OpenHandle(*info.This());
- Object* res = Script::cast(JSValue::cast(object)->value())->type();
+ Object* res =
+ Smi::FromInt(Script::cast(JSValue::cast(object)->value())->type());
info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(res, isolate)));
}
if (script->compilation_type() == Script::COMPILATION_TYPE_EVAL) {
Handle<Code> code(SharedFunctionInfo::cast(
script->eval_from_shared())->code());
- result = Handle<Object>(
- Smi::FromInt(code->SourcePosition(code->instruction_start() +
- script->eval_from_instructions_offset()->value())),
- isolate);
+ result = Handle<Object>(Smi::FromInt(code->SourcePosition(
+ code->instruction_start() +
+ script->eval_from_instructions_offset())),
+ isolate);
}
info.GetReturnValue().Set(Utils::ToLocal(result));
}
Name* name = Name::cast(script->name());
info->script_name = names_->GetName(name);
}
- info->script_id = script->id()->value();
+ info->script_id = script->id();
// Converting start offset into line and column may cause heap
// allocations so we postpone them until snapshot serialization.
unresolved_locations_.Add(new UnresolvedLocation(
ScriptOriginOptions options(script->origin_options());
v8::ScriptOrigin origin(
Utils::ToLocal(scriptName),
- v8::Integer::New(v8_isolate, script->line_offset()->value()),
- v8::Integer::New(v8_isolate, script->column_offset()->value()),
+ v8::Integer::New(v8_isolate, script->line_offset()),
+ v8::Integer::New(v8_isolate, script->column_offset()),
v8::Boolean::New(v8_isolate, options.IsSharedCrossOrigin()),
- v8::Integer::New(v8_isolate, script->id()->value()),
+ v8::Integer::New(v8_isolate, script->id()),
v8::Boolean::New(v8_isolate, options.IsEmbedderDebugScript()),
Utils::ToLocal(source_map_url),
v8::Boolean::New(v8_isolate, options.IsOpaque()));
i::Handle<i::SharedFunctionInfo> function_info(
i::SharedFunctionInfo::cast(*obj));
i::Handle<i::Script> script(i::Script::cast(function_info->script()));
- return script->id()->value();
+ return script->id();
}
script->set_name(*Utils::OpenHandle(*(origin.ResourceName())));
}
if (!origin.ResourceLineOffset().IsEmpty()) {
- script->set_line_offset(i::Smi::FromInt(
- static_cast<int>(origin.ResourceLineOffset()->Value())));
+ script->set_line_offset(
+ static_cast<int>(origin.ResourceLineOffset()->Value()));
}
if (!origin.ResourceColumnOffset().IsEmpty()) {
- script->set_column_offset(i::Smi::FromInt(
- static_cast<int>(origin.ResourceColumnOffset()->Value())));
+ script->set_column_offset(
+ static_cast<int>(origin.ResourceColumnOffset()->Value()));
}
script->set_origin_options(origin.Options());
if (!origin.SourceMapUrl().IsEmpty()) {
return v8::UnboundScript::kNoScriptId;
}
i::Handle<i::Script> script(i::Script::cast(func->shared()->script()));
- return script->id()->value();
+ return script->id();
}
// --- E m p t y ---
Handle<String> source = factory->NewStringFromStaticChars("() {}");
Handle<Script> script = factory->NewScript(source);
- script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
+ script->set_type(Script::TYPE_NATIVE);
empty_function->shared()->set_start_position(0);
empty_function->shared()->set_end_position(source->length());
empty_function->shared()->DontAdaptArguments();
DCHECK(!str.is_null());
cache_->set(length, *str);
cache_->set(length + 1, *shared);
- Script::cast(shared->script())->set_type(Smi::FromInt(type_));
+ Script::cast(shared->script())->set_type(type_);
}
private:
return script->name()->IsUndefined();
}
// Do the fast bailout checks first.
- if (line_offset != script->line_offset()->value()) return false;
- if (column_offset != script->column_offset()->value()) return false;
+ if (line_offset != script->line_offset()) return false;
+ if (column_offset != script->column_offset()) return false;
// Check that both names are strings. If not, no match.
if (!name->IsString() || !script->name()->IsString()) return false;
// Are the origin_options same?
shared->start_position());
if (!shared->script()->IsUndefined()) {
Handle<Script> script(Script::cast(shared->script()));
- info.script_id = script->id()->value();
+ info.script_id = script->id();
if (FLAG_hydrogen_track_positions && !script->source()->IsUndefined()) {
CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer());
script = isolate->factory()->NewScript(source);
if (!script_name.is_null()) {
script->set_name(*script_name);
- script->set_line_offset(Smi::FromInt(line_offset));
- script->set_column_offset(Smi::FromInt(column_offset));
+ script->set_line_offset(line_offset);
+ script->set_column_offset(column_offset);
}
script->set_origin_options(options);
Zone zone;
// Create a script object describing the script to be compiled.
Handle<Script> script = isolate->factory()->NewScript(source);
if (natives == NATIVES_CODE) {
- script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
+ script->set_type(Script::TYPE_NATIVE);
script->set_hide_source(true);
}
if (!script_name.is_null()) {
script->set_name(*script_name);
- script->set_line_offset(Smi::FromInt(line_offset));
- script->set_column_offset(Smi::FromInt(column_offset));
+ script->set_line_offset(line_offset);
+ script->set_column_offset(column_offset);
}
script->set_origin_options(resource_options);
if (!source_map_url.is_null()) {
i::JSFunction::cast(*compiled_script)->shared()->script()))
: i::Handle<i::Script>(i::Script::cast(
i::SharedFunctionInfo::cast(*compiled_script)->script()));
- script_object->set_type(i::Smi::FromInt(i::Script::TYPE_NATIVE));
+ script_object->set_type(i::Script::TYPE_NATIVE);
}
#endif // !V8_SHARED
Handle<DebugInfo> debug_info = node->debug_info();
// Find the break point and clear it.
- Address pc = debug_info->code()->entry() +
- break_point_info->code_position()->value();
+ Address pc =
+ debug_info->code()->entry() + break_point_info->code_position();
BreakLocation location =
BreakLocation::FromAddress(debug_info, ALL_BREAK_LOCATIONS, pc);
Smi* position = NULL;
switch (position_alignment) {
case STATEMENT_ALIGNED:
- position = break_point_info->statement_position();
+ position = Smi::FromInt(break_point_info->statement_position());
break;
case BREAK_POSITION_ALIGNED:
- position = break_point_info->source_position();
+ position = Smi::FromInt(break_point_info->source_position());
break;
}
for (int j = 0; j < break_points; ++j) locations->set(count++, position);
Code* code = it.frame()->LookupCode();
int offset = static_cast<int>(
it.frame()->pc() - code->instruction_start());
- script->set_eval_from_instructions_offset(Smi::FromInt(offset));
+ script->set_eval_from_instructions_offset(offset);
}
}
script->set_source(*source);
script->set_name(heap->undefined_value());
script->set_id(isolate()->heap()->NextScriptId());
- script->set_line_offset(Smi::FromInt(0));
- script->set_column_offset(Smi::FromInt(0));
+ script->set_line_offset(0);
+ script->set_column_offset(0);
script->set_context_data(heap->undefined_value());
- script->set_type(Smi::FromInt(Script::TYPE_NORMAL));
+ script->set_type(Script::TYPE_NORMAL);
script->set_wrapper(heap->undefined_value());
script->set_line_ends(heap->undefined_value());
script->set_eval_from_shared(heap->undefined_value());
- script->set_eval_from_instructions_offset(Smi::FromInt(0));
+ script->set_eval_from_instructions_offset(0);
script->set_shared_function_infos(Smi::FromInt(0));
- script->set_flags(Smi::FromInt(0));
+ script->set_flags(0);
heap->set_script_list(*WeakFixedArray::Add(script_list(), script));
return script;
Object* script = frame()->function()->shared()->script();
// Don't show functions from native scripts to user.
return (script->IsScript() &&
- Script::TYPE_NATIVE != Script::cast(script)->type()->value());
+ Script::TYPE_NATIVE != Script::cast(script)->type());
}
}
-Smi* Heap::NextScriptId() {
- int next_id = last_script_id()->value() + 1;
- if (!Smi::IsValid(next_id) || next_id < 0) next_id = 1;
- Smi* next_id_smi = Smi::FromInt(next_id);
- set_last_script_id(next_id_smi);
- return next_id_smi;
+int Heap::NextScriptId() {
+ int last_id = last_script_id()->value();
+ if (last_id == Smi::kMaxValue) {
+ last_id = 1;
+ } else {
+ last_id++;
+ }
+ set_last_script_id(Smi::FromInt(last_id));
+ return last_id;
}
set_materialized_objects(*factory->NewFixedArray(0, TENURED));
- // Handling of script id generation is in Factory::NewScript.
+ // Handling of script id generation is in Heap::NextScriptId().
set_last_script_id(Smi::FromInt(v8::UnboundScript::kNoScriptId));
// Allocate the empty script.
Handle<Script> script = factory->NewScript(factory->empty_string());
- script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
+ script->set_type(Script::TYPE_NATIVE);
set_empty_script(*script);
Handle<PropertyCell> cell = factory->NewPropertyCell();
Symbol::cast(result)
->set_hash_field(Name::kIsNotArrayIndexMask | (hash << Name::kHashShift));
Symbol::cast(result)->set_name(undefined_value());
- Symbol::cast(result)->set_flags(Smi::FromInt(0));
+ Symbol::cast(result)->set_flags(0);
DCHECK(!Symbol::cast(result)->is_private());
return result;
inline uint32_t HashSeed();
- inline Smi* NextScriptId();
+ inline int NextScriptId();
inline void SetArgumentsAdaptorDeoptPCOffset(int pc_offset);
inline void SetConstructStubDeoptPCOffset(int pc_offset);
Handle<Script> script(Script::cast(fun->shared()->script()));
if (!line_key_.is_null()) {
- int script_line_offset = script->line_offset()->value();
+ int script_line_offset = script->line_offset();
int line_number = Script::GetLineNumber(script, position);
// line_number is already shifted by the script_line_offset.
int relative_line_number = line_number - script_line_offset;
if (relative_line_number == 0) {
// For the case where the code is on the same line as the script
// tag.
- column_offset += script->column_offset()->value();
+ column_offset += script->column_offset();
}
JSObject::AddProperty(stack_frame, column_key_,
handle(Smi::FromInt(column_offset + 1), isolate_),
if (!script_id_key_.is_null()) {
JSObject::AddProperty(stack_frame, script_id_key_,
- handle(script->id(), isolate_), NONE);
+ handle(Smi::FromInt(script->id()), isolate_), NONE);
}
if (!script_name_key_.is_null()) {
Logger::LogEventsAndTags Logger::ToNativeByScript(Logger::LogEventsAndTags tag,
Script* script) {
- if ((tag == FUNCTION_TAG || tag == LAZY_COMPILE_TAG || tag == SCRIPT_TAG)
- && script->type()->value() == Script::TYPE_NATIVE) {
+ if ((tag == FUNCTION_TAG || tag == LAZY_COMPILE_TAG || tag == SCRIPT_TAG) &&
+ script->type() == Script::TYPE_NATIVE) {
switch (tag) {
case FUNCTION_TAG: return NATIVE_FUNCTION_TAG;
case LAZY_COMPILE_TAG: return NATIVE_LAZY_COMPILE_TAG;
bool CallSite::IsNative() {
Handle<Object> script(fun_->shared()->script(), isolate_);
return script->IsScript() &&
- Handle<Script>::cast(script)->type()->value() == Script::TYPE_NATIVE;
+ Handle<Script>::cast(script)->type() == Script::TYPE_NATIVE;
}
CHECK(HasHashCode());
CHECK_GT(Hash(), 0u);
CHECK(name()->IsUndefined() || name()->IsString());
- CHECK(flags()->IsSmi());
}
void AccessorInfo::AccessorInfoVerify() {
VerifyPointer(name());
- VerifyPointer(flag());
VerifyPointer(expected_receiver_type());
}
CHECK(IsScript());
VerifyPointer(source());
VerifyPointer(name());
- line_offset()->SmiVerify();
- column_offset()->SmiVerify();
VerifyPointer(wrapper());
- type()->SmiVerify();
VerifyPointer(line_ends());
- VerifyPointer(id());
}
void BreakPointInfo::BreakPointInfoVerify() {
CHECK(IsBreakPointInfo());
- code_position()->SmiVerify();
- source_position()->SmiVerify();
- statement_position()->SmiVerify();
VerifyPointer(break_point_objects());
}
#endif // VERIFY_HEAP
}
-// Getter that returns a tagged Smi and setter that writes a tagged Smi.
-#define ACCESSORS_TO_SMI(holder, name, offset) \
- Smi* holder::name() const { return Smi::cast(READ_FIELD(this, offset)); } \
- void holder::set_##name(Smi* value, WriteBarrierMode mode) { \
- WRITE_FIELD(this, offset, value); \
- }
-
-
// Getter that returns a Smi as an int and writes an int as a Smi.
#define SMI_ACCESSORS(holder, name, offset) \
int holder::name() const { \
set_transition_info(Smi::FromInt(0));
SetElementsKind(GetInitialFastElementsKind());
set_nested_site(Smi::FromInt(0));
- set_pretenure_data(Smi::FromInt(0));
- set_pretenure_create_count(Smi::FromInt(0));
+ set_pretenure_data(0);
+ set_pretenure_create_count(0);
set_dependent_code(DependentCode::cast(GetHeap()->empty_fixed_array()),
SKIP_WRITE_BARRIER);
}
AllocationSite::PretenureDecision AllocationSite::pretenure_decision() {
- int value = pretenure_data()->value();
+ int value = pretenure_data();
return PretenureDecisionBits::decode(value);
}
void AllocationSite::set_pretenure_decision(PretenureDecision decision) {
- int value = pretenure_data()->value();
- set_pretenure_data(
- Smi::FromInt(PretenureDecisionBits::update(value, decision)),
- SKIP_WRITE_BARRIER);
+ int value = pretenure_data();
+ set_pretenure_data(PretenureDecisionBits::update(value, decision));
}
bool AllocationSite::deopt_dependent_code() {
- int value = pretenure_data()->value();
+ int value = pretenure_data();
return DeoptDependentCodeBit::decode(value);
}
void AllocationSite::set_deopt_dependent_code(bool deopt) {
- int value = pretenure_data()->value();
- set_pretenure_data(Smi::FromInt(DeoptDependentCodeBit::update(value, deopt)),
- SKIP_WRITE_BARRIER);
+ int value = pretenure_data();
+ set_pretenure_data(DeoptDependentCodeBit::update(value, deopt));
}
int AllocationSite::memento_found_count() {
- int value = pretenure_data()->value();
+ int value = pretenure_data();
return MementoFoundCountBits::decode(value);
}
inline void AllocationSite::set_memento_found_count(int count) {
- int value = pretenure_data()->value();
+ int value = pretenure_data();
// Verify that we can count more mementos than we can possibly find in one
// new space collection.
DCHECK((GetHeap()->MaxSemiSpaceSize() /
(Heap::kMinObjectSizeInWords * kPointerSize +
AllocationMemento::kSize)) < MementoFoundCountBits::kMax);
DCHECK(count < MementoFoundCountBits::kMax);
- set_pretenure_data(
- Smi::FromInt(MementoFoundCountBits::update(value, count)),
- SKIP_WRITE_BARRIER);
+ set_pretenure_data(MementoFoundCountBits::update(value, count));
}
-int AllocationSite::memento_create_count() {
- return pretenure_create_count()->value();
-}
+int AllocationSite::memento_create_count() { return pretenure_create_count(); }
void AllocationSite::set_memento_create_count(int count) {
- set_pretenure_create_count(Smi::FromInt(count), SKIP_WRITE_BARRIER);
+ set_pretenure_create_count(count);
}
ACCESSORS(Symbol, name, Object, kNameOffset)
-ACCESSORS(Symbol, flags, Smi, kFlagsOffset)
+SMI_ACCESSORS(Symbol, flags, kFlagsOffset)
BOOL_ACCESSORS(Symbol, flags, is_private, kPrivateBit)
ACCESSORS(JSGlobalProxy, hash, Object, kHashOffset)
ACCESSORS(AccessorInfo, name, Object, kNameOffset)
-ACCESSORS_TO_SMI(AccessorInfo, flag, kFlagOffset)
+SMI_ACCESSORS(AccessorInfo, flag, kFlagOffset)
ACCESSORS(AccessorInfo, expected_receiver_type, Object,
kExpectedReceiverTypeOffset)
kInstanceCallHandlerOffset)
ACCESSORS(FunctionTemplateInfo, access_check_info, Object,
kAccessCheckInfoOffset)
-ACCESSORS_TO_SMI(FunctionTemplateInfo, flag, kFlagOffset)
+SMI_ACCESSORS(FunctionTemplateInfo, flag, kFlagOffset)
ACCESSORS(ObjectTemplateInfo, constructor, Object, kConstructorOffset)
ACCESSORS(ObjectTemplateInfo, internal_field_count, Object,
ACCESSORS(AllocationSite, transition_info, Object, kTransitionInfoOffset)
ACCESSORS(AllocationSite, nested_site, Object, kNestedSiteOffset)
-ACCESSORS_TO_SMI(AllocationSite, pretenure_data, kPretenureDataOffset)
-ACCESSORS_TO_SMI(AllocationSite, pretenure_create_count,
- kPretenureCreateCountOffset)
+SMI_ACCESSORS(AllocationSite, pretenure_data, kPretenureDataOffset)
+SMI_ACCESSORS(AllocationSite, pretenure_create_count,
+ kPretenureCreateCountOffset)
ACCESSORS(AllocationSite, dependent_code, DependentCode,
kDependentCodeOffset)
ACCESSORS(AllocationSite, weak_next, Object, kWeakNextOffset)
ACCESSORS(Script, source, Object, kSourceOffset)
ACCESSORS(Script, name, Object, kNameOffset)
-ACCESSORS(Script, id, Smi, kIdOffset)
-ACCESSORS_TO_SMI(Script, line_offset, kLineOffsetOffset)
-ACCESSORS_TO_SMI(Script, column_offset, kColumnOffsetOffset)
+SMI_ACCESSORS(Script, id, kIdOffset)
+SMI_ACCESSORS(Script, line_offset, kLineOffsetOffset)
+SMI_ACCESSORS(Script, column_offset, kColumnOffsetOffset)
ACCESSORS(Script, context_data, Object, kContextOffset)
ACCESSORS(Script, wrapper, HeapObject, kWrapperOffset)
-ACCESSORS_TO_SMI(Script, type, kTypeOffset)
+SMI_ACCESSORS(Script, type, kTypeOffset)
ACCESSORS(Script, line_ends, Object, kLineEndsOffset)
ACCESSORS(Script, eval_from_shared, Object, kEvalFromSharedOffset)
-ACCESSORS_TO_SMI(Script, eval_from_instructions_offset,
- kEvalFrominstructionsOffsetOffset)
+SMI_ACCESSORS(Script, eval_from_instructions_offset,
+ kEvalFrominstructionsOffsetOffset)
ACCESSORS(Script, shared_function_infos, Object, kSharedFunctionInfosOffset)
-ACCESSORS_TO_SMI(Script, flags, kFlagsOffset)
+SMI_ACCESSORS(Script, flags, kFlagsOffset)
ACCESSORS(Script, source_url, Object, kSourceUrlOffset)
ACCESSORS(Script, source_mapping_url, Object, kSourceMappingUrlOffset)
state == COMPILATION_STATE_COMPILED));
}
ScriptOriginOptions Script::origin_options() {
- return ScriptOriginOptions((flags()->value() & kOriginOptionsMask) >>
+ return ScriptOriginOptions((flags() & kOriginOptionsMask) >>
kOriginOptionsShift);
}
void Script::set_origin_options(ScriptOriginOptions origin_options) {
DCHECK(!(origin_options.Flags() & ~((1 << kOriginOptionsSize) - 1)));
- set_flags(Smi::FromInt((flags()->value() & ~kOriginOptionsMask) |
- (origin_options.Flags() << kOriginOptionsShift)));
+ set_flags((flags() & ~kOriginOptionsMask) |
+ (origin_options.Flags() << kOriginOptionsShift));
}
ACCESSORS(DebugInfo, code, Code, kCodeIndex)
ACCESSORS(DebugInfo, break_points, FixedArray, kBreakPointsStateIndex)
-ACCESSORS_TO_SMI(BreakPointInfo, code_position, kCodePositionIndex)
-ACCESSORS_TO_SMI(BreakPointInfo, source_position, kSourcePositionIndex)
-ACCESSORS_TO_SMI(BreakPointInfo, statement_position, kStatementPositionIndex)
+SMI_ACCESSORS(BreakPointInfo, code_position, kCodePositionIndex)
+SMI_ACCESSORS(BreakPointInfo, source_position, kSourcePositionIndex)
+SMI_ACCESSORS(BreakPointInfo, statement_position, kStatementPositionIndex)
ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex)
ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset)
Object* script_obj = script();
if (script_obj->IsUndefined()) return true;
Script* script = Script::cast(script_obj);
- Script::Type type = static_cast<Script::Type>(script->type()->value());
+ Script::Type type = static_cast<Script::Type>(script->type());
return type != Script::TYPE_NORMAL;
}
PropertyAttributes AccessorInfo::property_attributes() {
- return AttributesField::decode(static_cast<uint32_t>(flag()->value()));
+ return AttributesField::decode(static_cast<uint32_t>(flag()));
}
void AccessorInfo::set_property_attributes(PropertyAttributes attributes) {
- set_flag(Smi::FromInt(AttributesField::update(flag()->value(), attributes)));
+ set_flag(AttributesField::update(flag(), attributes));
}
#undef CAST_ACCESSOR
#undef INT_ACCESSORS
#undef ACCESSORS
-#undef ACCESSORS_TO_SMI
#undef SMI_ACCESSORS
#undef SYNCHRONIZED_SMI_ACCESSORS
#undef NOBARRIER_SMI_ACCESSORS
std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "ExecutableAccessorInfo");
os << "\n - name: " << Brief(name());
- os << "\n - flag: " << Brief(flag());
+ os << "\n - flag: " << flag();
os << "\n - getter: " << Brief(getter());
os << "\n - setter: " << Brief(setter());
os << "\n - data: " << Brief(data());
HeapObject::PrintHeader(os, "Script");
os << "\n - source: " << Brief(source());
os << "\n - name: " << Brief(name());
- os << "\n - line_offset: " << Brief(line_offset());
- os << "\n - column_offset: " << Brief(column_offset());
- os << "\n - type: " << Brief(type());
- os << "\n - id: " << Brief(id());
+ os << "\n - line_offset: " << line_offset();
+ os << "\n - column_offset: " << column_offset();
+ os << "\n - type: " << type();
+ os << "\n - id: " << id();
os << "\n - context data: " << Brief(context_data());
os << "\n - wrapper: " << Brief(wrapper());
os << "\n - compilation type: " << compilation_type();
os << "\n - line ends: " << Brief(line_ends());
os << "\n - eval from shared: " << Brief(eval_from_shared());
os << "\n - eval from instructions offset: "
- << Brief(eval_from_instructions_offset());
+ << eval_from_instructions_offset();
os << "\n - shared function infos: " << Brief(shared_function_infos());
os << "\n";
}
void BreakPointInfo::BreakPointInfoPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "BreakPointInfo");
- os << "\n - code_position: " << code_position()->value();
- os << "\n - source_position: " << source_position()->value();
- os << "\n - statement_position: " << statement_position()->value();
+ os << "\n - code_position: " << code_position();
+ os << "\n - source_position: " << source_position();
+ os << "\n - statement_position: " << statement_position();
os << "\n - break_point_objects: " << Brief(break_point_objects());
os << "\n";
}
DisallowHeapAllocation no_allocation;
FixedArray* line_ends_array = FixedArray::cast(script->line_ends());
- line_number = line_number - script->line_offset()->value();
- if (line_number == 0) return code_pos + script->column_offset()->value();
+ line_number = line_number - script->line_offset();
+ if (line_number == 0) return code_pos + script->column_offset();
int prev_line_end_pos =
Smi::cast(line_ends_array->get(line_number - 1))->value();
return code_pos - (prev_line_end_pos + 1);
if (line_ends_len == 0) return -1;
if ((Smi::cast(line_ends_array->get(0)))->value() >= code_pos) {
- return line_offset()->value();
+ return line_offset();
}
int left = 0;
left += half;
}
}
- return right + line_offset()->value();
+ return right + line_offset();
}
// Allocate new BreakPointInfo object and set the break point.
Handle<BreakPointInfo> new_break_point_info = Handle<BreakPointInfo>::cast(
isolate->factory()->NewStruct(BREAK_POINT_INFO_TYPE));
- new_break_point_info->set_code_position(Smi::FromInt(code_position));
- new_break_point_info->set_source_position(Smi::FromInt(source_position));
- new_break_point_info->
- set_statement_position(Smi::FromInt(statement_position));
+ new_break_point_info->set_code_position(code_position);
+ new_break_point_info->set_source_position(source_position);
+ new_break_point_info->set_statement_position(statement_position);
new_break_point_info->set_break_point_objects(
isolate->heap()->undefined_value());
BreakPointInfo::SetBreakPoint(new_break_point_info, break_point_object);
if (!break_points()->get(i)->IsUndefined()) {
BreakPointInfo* break_point_info =
BreakPointInfo::cast(break_points()->get(i));
- if (break_point_info->code_position()->value() == code_position) {
+ if (break_point_info->code_position() == code_position) {
return i;
}
}
};
-#define DECL_BOOLEAN_ACCESSORS(name) \
- inline bool name() const; \
- inline void set_##name(bool value); \
+#define DECL_BOOLEAN_ACCESSORS(name) \
+ inline bool name() const; \
+ inline void set_##name(bool value);
+
+#define DECL_INT_ACCESSORS(name) \
+ inline int name() const; \
+ inline void set_##name(int value);
#define DECL_ACCESSORS(name, type) \
DECL_ACCESSORS(name, Object)
// [id]: the script id.
- DECL_ACCESSORS(id, Smi)
+ DECL_INT_ACCESSORS(id)
// [line_offset]: script line offset in resource from where it was extracted.
- DECL_ACCESSORS(line_offset, Smi)
+ DECL_INT_ACCESSORS(line_offset)
// [column_offset]: script column offset in resource from where it was
// extracted.
- DECL_ACCESSORS(column_offset, Smi)
+ DECL_INT_ACCESSORS(column_offset)
// [context_data]: context data for the context this script was compiled in.
DECL_ACCESSORS(context_data, Object)
DECL_ACCESSORS(wrapper, HeapObject)
// [type]: the script type.
- DECL_ACCESSORS(type, Smi)
+ DECL_INT_ACCESSORS(type)
// [line_ends]: FixedArray of line ends positions.
DECL_ACCESSORS(line_ends, Object)
// [eval_from_instructions_offset]: the instruction offset in the code for the
// function from which eval was called where eval was called.
- DECL_ACCESSORS(eval_from_instructions_offset, Smi)
+ DECL_INT_ACCESSORS(eval_from_instructions_offset)
// [shared_function_infos]: weak fixed array containing all shared
// function infos created from this script.
DECL_ACCESSORS(shared_function_infos, Object)
// [flags]: Holds an exciting bitfield.
- DECL_ACCESSORS(flags, Smi)
+ DECL_INT_ACCESSORS(flags)
// [source_url]: sourceURL from magic comment
DECL_ACCESSORS(source_url, Object)
// walked in a particular order. So [[1, 2], 1, 2] will have one
// nested_site, but [[1, 2], 3, [4]] will have a list of two.
DECL_ACCESSORS(nested_site, Object)
- DECL_ACCESSORS(pretenure_data, Smi)
- DECL_ACCESSORS(pretenure_create_count, Smi)
+ DECL_INT_ACCESSORS(pretenure_data)
+ DECL_INT_ACCESSORS(pretenure_create_count)
DECL_ACCESSORS(dependent_code, DependentCode)
DECL_ACCESSORS(weak_next, Object)
// [name]: The print name of a symbol, or undefined if none.
DECL_ACCESSORS(name, Object)
- DECL_ACCESSORS(flags, Smi)
+ DECL_INT_ACCESSORS(flags)
// [is_private]: Whether this is a private symbol. Private symbols can only
// be used to designate own properties of objects.
class AccessorInfo: public Struct {
public:
DECL_ACCESSORS(name, Object)
- DECL_ACCESSORS(flag, Smi)
+ DECL_INT_ACCESSORS(flag)
DECL_ACCESSORS(expected_receiver_type, Object)
inline bool all_can_read();
DECL_ACCESSORS(signature, Object)
DECL_ACCESSORS(instance_call_handler, Object)
DECL_ACCESSORS(access_check_info, Object)
- DECL_ACCESSORS(flag, Smi)
+ DECL_INT_ACCESSORS(flag)
inline int length() const;
inline void set_length(int value);
class BreakPointInfo: public Struct {
public:
// The position in the code for the break point.
- DECL_ACCESSORS(code_position, Smi)
+ DECL_INT_ACCESSORS(code_position)
// The position in the source for the break position.
- DECL_ACCESSORS(source_position, Smi)
+ DECL_INT_ACCESSORS(source_position)
// The position in the source for the last statement before this break
// position.
- DECL_ACCESSORS(statement_position, Smi)
+ DECL_INT_ACCESSORS(statement_position)
// List of related JavaScript break points.
DECL_ACCESSORS(break_point_objects, Object)
};
-// BooleanBit is a helper class for setting and getting a bit in an
-// integer or Smi.
+// BooleanBit is a helper class for setting and getting a bit in an integer.
class BooleanBit : public AllStatic {
public:
- static inline bool get(Smi* smi, int bit_position) {
- return get(smi->value(), bit_position);
- }
-
static inline bool get(int value, int bit_position) {
return (value & (1 << bit_position)) != 0;
}
- static inline Smi* set(Smi* smi, int bit_position, bool v) {
- return Smi::FromInt(set(smi->value(), bit_position, v));
- }
-
static inline int set(int value, int bit_position, bool v) {
if (v) {
value |= (1 << bit_position);
Handle<Script> script(Script::cast(shared->script()));
set_script(script);
- if (!script.is_null() && script->type()->value() == Script::TYPE_NATIVE) {
+ if (!script.is_null() && script->type() == Script::TYPE_NATIVE) {
set_native();
}
}
set_unicode_cache(isolate_->unicode_cache());
set_script(script);
- if (script->type()->value() == Script::TYPE_NATIVE) {
+ if (script->type() == Script::TYPE_NATIVE) {
set_native();
}
}
void CodeEntry::FillFunctionInfo(SharedFunctionInfo* shared) {
if (!shared->script()->IsScript()) return;
Script* script = Script::cast(shared->script());
- set_script_id(script->id()->value());
+ set_script_id(script->id());
set_position(shared->start_position());
set_bailout_reason(GetBailoutReason(shared->disable_optimization_reason()));
}
if (!info->shared_info().is_null()) {
Object* script = info->shared_info()->script();
native = script->IsScript() &&
- Script::cast(script)->type()->value() == Script::TYPE_NATIVE;
+ Script::cast(script)->type() == Script::TYPE_NATIVE;
}
if (native ? FLAG_print_builtin_scopes : FLAG_print_scopes) scope->Print();