@@ -2846,8 +2846,8 @@ Local<StackFrame> StackTrace::GetFrame(uint32_t index) const {
28462846 EscapableHandleScope scope (reinterpret_cast <Isolate*>(isolate));
28472847 auto self = Utils::OpenHandle (this );
28482848 auto obj = i::JSReceiver::GetElement (isolate, self, index).ToHandleChecked ();
2849- auto jsobj = i::Handle<i::JSObject >::cast (obj);
2850- return scope.Escape (Utils::StackFrameToLocal (jsobj ));
2849+ auto info = i::Handle<i::StackFrameInfo >::cast (obj);
2850+ return scope.Escape (Utils::StackFrameToLocal (info ));
28512851}
28522852
28532853
@@ -2875,77 +2875,59 @@ Local<StackTrace> StackTrace::CurrentStackTrace(
28752875
28762876// --- S t a c k F r a m e ---
28772877
2878- static int getIntProperty (const StackFrame* f, const char * propertyName,
2879- int defaultValue) {
2880- i::Isolate* isolate = Utils::OpenHandle (f)->GetIsolate ();
2881- ENTER_V8_NO_SCRIPT_NO_EXCEPTION (isolate);
2882- i::HandleScope scope (isolate);
2883- i::Handle<i::JSObject> self = Utils::OpenHandle (f);
2884- i::Handle<i::Object> obj =
2885- i::JSReceiver::GetProperty (isolate, self, propertyName).ToHandleChecked ();
2886- return obj->IsSmi () ? i::Smi::cast (*obj)->value () : defaultValue;
2887- }
2888-
2889-
28902878int StackFrame::GetLineNumber () const {
2891- return getIntProperty (this , " lineNumber" , Message::kNoLineNumberInfo );
2879+ int v = Utils::OpenHandle (this )->line_number ();
2880+ return v ? v : Message::kNoLineNumberInfo ;
28922881}
28932882
28942883
28952884int StackFrame::GetColumn () const {
2896- return getIntProperty (this , " column" , Message::kNoColumnInfo );
2885+ int v = Utils::OpenHandle (this )->column_number ();
2886+ return v ? v : Message::kNoLineNumberInfo ;
28972887}
28982888
28992889
29002890int StackFrame::GetScriptId () const {
2901- return getIntProperty (this , " scriptId" , Message::kNoScriptIdInfo );
2891+ int v = Utils::OpenHandle (this )->script_id ();
2892+ return v ? v : Message::kNoScriptIdInfo ;
29022893}
29032894
2904-
2905- static Local<String> getStringProperty (const StackFrame* f,
2906- const char * propertyName) {
2907- i::Isolate* isolate = Utils::OpenHandle (f)->GetIsolate ();
2908- ENTER_V8_NO_SCRIPT_NO_EXCEPTION (isolate);
2895+ Local<String> StackFrame::GetScriptName () const {
2896+ i::Isolate* isolate = Utils::OpenHandle (this )->GetIsolate ();
29092897 EscapableHandleScope scope (reinterpret_cast <Isolate*>(isolate));
2910- i::Handle<i::JSObject> self = Utils::OpenHandle (f);
2911- i::Handle<i::Object> obj =
2912- i::JSReceiver::GetProperty (isolate, self, propertyName).ToHandleChecked ();
2898+ i::Handle<i::StackFrameInfo> self = Utils::OpenHandle (this );
2899+ i::Handle<i::Object> obj (self->script_name (), isolate);
29132900 return obj->IsString ()
29142901 ? scope.Escape (Local<String>::Cast (Utils::ToLocal (obj)))
29152902 : Local<String>();
29162903}
29172904
29182905
2919- Local<String> StackFrame::GetScriptName () const {
2920- return getStringProperty (this , " scriptName" );
2921- }
2922-
2923-
29242906Local<String> StackFrame::GetScriptNameOrSourceURL () const {
2925- return getStringProperty (this , " scriptNameOrSourceURL" );
2907+ i::Isolate* isolate = Utils::OpenHandle (this )->GetIsolate ();
2908+ EscapableHandleScope scope (reinterpret_cast <Isolate*>(isolate));
2909+ i::Handle<i::StackFrameInfo> self = Utils::OpenHandle (this );
2910+ i::Handle<i::Object> obj (self->script_name_or_source_url (), isolate);
2911+ return obj->IsString ()
2912+ ? scope.Escape (Local<String>::Cast (Utils::ToLocal (obj)))
2913+ : Local<String>();
29262914}
29272915
29282916
29292917Local<String> StackFrame::GetFunctionName () const {
2930- return getStringProperty (this , " functionName" );
2931- }
2932-
2933-
2934- static bool getBoolProperty (const StackFrame* f, const char * propertyName) {
2935- i::Isolate* isolate = Utils::OpenHandle (f)->GetIsolate ();
2936- ENTER_V8_NO_SCRIPT_NO_EXCEPTION (isolate);
2937- i::HandleScope scope (isolate);
2938- i::Handle<i::JSObject> self = Utils::OpenHandle (f);
2939- i::Handle<i::Object> obj =
2940- i::JSReceiver::GetProperty (isolate, self, propertyName).ToHandleChecked ();
2941- return obj->IsTrue (isolate);
2918+ i::Isolate* isolate = Utils::OpenHandle (this )->GetIsolate ();
2919+ EscapableHandleScope scope (reinterpret_cast <Isolate*>(isolate));
2920+ i::Handle<i::StackFrameInfo> self = Utils::OpenHandle (this );
2921+ i::Handle<i::Object> obj (self->function_name (), isolate);
2922+ return obj->IsString ()
2923+ ? scope.Escape (Local<String>::Cast (Utils::ToLocal (obj)))
2924+ : Local<String>();
29422925}
29432926
2944- bool StackFrame::IsEval () const { return getBoolProperty (this , " isEval" ); }
2945-
2927+ bool StackFrame::IsEval () const { return Utils::OpenHandle (this )->is_eval (); }
29462928
29472929bool StackFrame::IsConstructor () const {
2948- return getBoolProperty (this , " isConstructor " );
2930+ return Utils::OpenHandle (this )-> is_constructor ( );
29492931}
29502932
29512933
0 commit comments