From: jkummerow Date: Mon, 28 Sep 2015 13:10:13 +0000 (-0700) Subject: objects-inl.h: Remove ACCESSORS_TO_SMI macro X-Git-Tag: upstream/4.7.83~65 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7117acd26c04c7bcfda20d8f55b7e5ec8418439c;p=platform%2Fupstream%2Fv8.git objects-inl.h: Remove ACCESSORS_TO_SMI macro Replacing it with SMI_ACCESSORS. This change makes accesses to Smi fields in objects more regular (the accessors now always consume/return an int rather than a Smi*), which avoids a bunch of manual Smi::FromInt() and Smi::value() conversions, and is a step on the way towards being able to generate objects-inl.h. Review URL: https://codereview.chromium.org/1371893002 Cr-Commit-Position: refs/heads/master@{#30975} --- diff --git a/src/accessors.cc b/src/accessors.cc index c04b26681..5bd22bd8d 100644 --- a/src/accessors.cc +++ b/src/accessors.cc @@ -318,7 +318,8 @@ void Accessors::ScriptColumnOffsetGetter( 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(res, isolate))); } @@ -355,7 +356,7 @@ void Accessors::ScriptIdGetter( 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(id, isolate))); } @@ -462,7 +463,8 @@ void Accessors::ScriptLineOffsetGetter( 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(res, isolate))); } @@ -499,7 +501,8 @@ void Accessors::ScriptTypeGetter( 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(res, isolate))); } @@ -814,10 +817,10 @@ void Accessors::ScriptEvalFromScriptPositionGetter( if (script->compilation_type() == Script::COMPILATION_TYPE_EVAL) { Handle code(SharedFunctionInfo::cast( script->eval_from_shared())->code()); - result = Handle( - Smi::FromInt(code->SourcePosition(code->instruction_start() + - script->eval_from_instructions_offset()->value())), - isolate); + result = Handle(Smi::FromInt(code->SourcePosition( + code->instruction_start() + + script->eval_from_instructions_offset())), + isolate); } info.GetReturnValue().Set(Utils::ToLocal(result)); } diff --git a/src/allocation-tracker.cc b/src/allocation-tracker.cc index 3125b0215..cc6d52258 100644 --- a/src/allocation-tracker.cc +++ b/src/allocation-tracker.cc @@ -273,7 +273,7 @@ unsigned AllocationTracker::AddFunctionInfo(SharedFunctionInfo* shared, 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( diff --git a/src/api.cc b/src/api.cc index d1e03b911..1d9cd48b9 100644 --- a/src/api.cc +++ b/src/api.cc @@ -195,10 +195,10 @@ static ScriptOrigin GetScriptOriginForScript(i::Isolate* isolate, 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())); @@ -1611,7 +1611,7 @@ int UnboundScript::GetId() { i::Handle function_info( i::SharedFunctionInfo::cast(*obj)); i::Handle script(i::Script::cast(function_info->script())); - return script->id()->value(); + return script->id(); } @@ -1984,12 +1984,12 @@ MaybeLocal