| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1608 | 1608 |
| 1609 | 1609 |
| 1610 int UnboundScript::GetLineNumber(int code_pos) { | 1610 int UnboundScript::GetLineNumber(int code_pos) { |
| 1611 i::Handle<i::HeapObject> obj = | 1611 i::Handle<i::HeapObject> obj = |
| 1612 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this)); | 1612 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this)); |
| 1613 i::Isolate* isolate = obj->GetIsolate(); | 1613 i::Isolate* isolate = obj->GetIsolate(); |
| 1614 ON_BAILOUT(isolate, "v8::UnboundScript::GetLineNumber()", return -1); | 1614 ON_BAILOUT(isolate, "v8::UnboundScript::GetLineNumber()", return -1); |
| 1615 LOG_API(isolate, "UnboundScript::GetLineNumber"); | 1615 LOG_API(isolate, "UnboundScript::GetLineNumber"); |
| 1616 if (obj->IsScript()) { | 1616 if (obj->IsScript()) { |
| 1617 i::Handle<i::Script> script(i::Script::cast(*obj)); | 1617 i::Handle<i::Script> script(i::Script::cast(*obj)); |
| 1618 return i::Script::GetLineNumber(script, code_pos); | 1618 return i::GetScriptLineNumber(script, code_pos); |
| 1619 } else { | 1619 } else { |
| 1620 return -1; | 1620 return -1; |
| 1621 } | 1621 } |
| 1622 } | 1622 } |
| 1623 | 1623 |
| 1624 | 1624 |
| 1625 Handle<Value> UnboundScript::GetScriptName() { | 1625 Handle<Value> UnboundScript::GetScriptName() { |
| 1626 i::Handle<i::HeapObject> obj = | 1626 i::Handle<i::HeapObject> obj = |
| 1627 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this)); | 1627 i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this)); |
| 1628 i::Isolate* isolate = obj->GetIsolate(); | 1628 i::Isolate* isolate = obj->GetIsolate(); |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1976 return scope.Escape(Utils::StackTraceToLocal(stackTrace)); | 1976 return scope.Escape(Utils::StackTraceToLocal(stackTrace)); |
| 1977 } | 1977 } |
| 1978 | 1978 |
| 1979 | 1979 |
| 1980 MUST_USE_RESULT static i::MaybeHandle<i::Object> CallV8HeapFunction( | 1980 MUST_USE_RESULT static i::MaybeHandle<i::Object> CallV8HeapFunction( |
| 1981 const char* name, | 1981 const char* name, |
| 1982 i::Handle<i::Object> recv, | 1982 i::Handle<i::Object> recv, |
| 1983 int argc, | 1983 int argc, |
| 1984 i::Handle<i::Object> argv[]) { | 1984 i::Handle<i::Object> argv[]) { |
| 1985 i::Isolate* isolate = i::Isolate::Current(); | 1985 i::Isolate* isolate = i::Isolate::Current(); |
| 1986 i::Handle<i::String> fmt_str = |
| 1987 isolate->factory()->InternalizeUtf8String(name); |
| 1986 i::Handle<i::Object> object_fun = | 1988 i::Handle<i::Object> object_fun = |
| 1987 i::Object::GetProperty( | 1989 i::Object::GetProperty( |
| 1988 isolate, isolate->js_builtins_object(), name).ToHandleChecked(); | 1990 isolate->js_builtins_object(), fmt_str).ToHandleChecked(); |
| 1989 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(object_fun); | 1991 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(object_fun); |
| 1990 return i::Execution::Call(isolate, fun, recv, argc, argv); | 1992 return i::Execution::Call(isolate, fun, recv, argc, argv); |
| 1991 } | 1993 } |
| 1992 | 1994 |
| 1993 | 1995 |
| 1994 MUST_USE_RESULT static i::MaybeHandle<i::Object> CallV8HeapFunction( | 1996 MUST_USE_RESULT static i::MaybeHandle<i::Object> CallV8HeapFunction( |
| 1995 const char* name, | 1997 const char* name, |
| 1996 i::Handle<i::Object> data) { | 1998 i::Handle<i::Object> data) { |
| 1997 i::Handle<i::Object> argv[] = { data }; | 1999 i::Handle<i::Object> argv[] = { data }; |
| 1998 return CallV8HeapFunction(name, | 2000 return CallV8HeapFunction(name, |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2147 } | 2149 } |
| 2148 | 2150 |
| 2149 | 2151 |
| 2150 // --- S t a c k F r a m e --- | 2152 // --- S t a c k F r a m e --- |
| 2151 | 2153 |
| 2152 int StackFrame::GetLineNumber() const { | 2154 int StackFrame::GetLineNumber() const { |
| 2153 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 2155 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 2154 ENTER_V8(isolate); | 2156 ENTER_V8(isolate); |
| 2155 i::HandleScope scope(isolate); | 2157 i::HandleScope scope(isolate); |
| 2156 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 2158 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 2157 i::Handle<i::Object> line = i::Object::GetProperty( | 2159 i::Handle<i::Object> line = GetProperty(self, "lineNumber").ToHandleChecked(); |
| 2158 isolate, self, "lineNumber").ToHandleChecked(); | |
| 2159 if (!line->IsSmi()) { | 2160 if (!line->IsSmi()) { |
| 2160 return Message::kNoLineNumberInfo; | 2161 return Message::kNoLineNumberInfo; |
| 2161 } | 2162 } |
| 2162 return i::Smi::cast(*line)->value(); | 2163 return i::Smi::cast(*line)->value(); |
| 2163 } | 2164 } |
| 2164 | 2165 |
| 2165 | 2166 |
| 2166 int StackFrame::GetColumn() const { | 2167 int StackFrame::GetColumn() const { |
| 2167 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 2168 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 2168 ENTER_V8(isolate); | 2169 ENTER_V8(isolate); |
| 2169 i::HandleScope scope(isolate); | 2170 i::HandleScope scope(isolate); |
| 2170 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 2171 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 2171 i::Handle<i::Object> column = i::Object::GetProperty( | 2172 i::Handle<i::Object> column = GetProperty(self, "column").ToHandleChecked(); |
| 2172 isolate, self, "column").ToHandleChecked(); | |
| 2173 if (!column->IsSmi()) { | 2173 if (!column->IsSmi()) { |
| 2174 return Message::kNoColumnInfo; | 2174 return Message::kNoColumnInfo; |
| 2175 } | 2175 } |
| 2176 return i::Smi::cast(*column)->value(); | 2176 return i::Smi::cast(*column)->value(); |
| 2177 } | 2177 } |
| 2178 | 2178 |
| 2179 | 2179 |
| 2180 int StackFrame::GetScriptId() const { | 2180 int StackFrame::GetScriptId() const { |
| 2181 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 2181 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 2182 ENTER_V8(isolate); | 2182 ENTER_V8(isolate); |
| 2183 i::HandleScope scope(isolate); | 2183 i::HandleScope scope(isolate); |
| 2184 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 2184 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 2185 i::Handle<i::Object> scriptId = i::Object::GetProperty( | 2185 i::Handle<i::Object> scriptId = |
| 2186 isolate, self, "scriptId").ToHandleChecked(); | 2186 GetProperty(self, "scriptId").ToHandleChecked(); |
| 2187 if (!scriptId->IsSmi()) { | 2187 if (!scriptId->IsSmi()) { |
| 2188 return Message::kNoScriptIdInfo; | 2188 return Message::kNoScriptIdInfo; |
| 2189 } | 2189 } |
| 2190 return i::Smi::cast(*scriptId)->value(); | 2190 return i::Smi::cast(*scriptId)->value(); |
| 2191 } | 2191 } |
| 2192 | 2192 |
| 2193 | 2193 |
| 2194 Local<String> StackFrame::GetScriptName() const { | 2194 Local<String> StackFrame::GetScriptName() const { |
| 2195 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 2195 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 2196 ENTER_V8(isolate); | 2196 ENTER_V8(isolate); |
| 2197 EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate)); | 2197 EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate)); |
| 2198 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 2198 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 2199 i::Handle<i::Object> name = i::Object::GetProperty( | 2199 i::Handle<i::Object> name = GetProperty(self, "scriptName").ToHandleChecked(); |
| 2200 isolate, self, "scriptName").ToHandleChecked(); | |
| 2201 if (!name->IsString()) { | 2200 if (!name->IsString()) { |
| 2202 return Local<String>(); | 2201 return Local<String>(); |
| 2203 } | 2202 } |
| 2204 return scope.Escape(Local<String>::Cast(Utils::ToLocal(name))); | 2203 return scope.Escape(Local<String>::Cast(Utils::ToLocal(name))); |
| 2205 } | 2204 } |
| 2206 | 2205 |
| 2207 | 2206 |
| 2208 Local<String> StackFrame::GetScriptNameOrSourceURL() const { | 2207 Local<String> StackFrame::GetScriptNameOrSourceURL() const { |
| 2209 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 2208 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 2210 ENTER_V8(isolate); | 2209 ENTER_V8(isolate); |
| 2211 EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate)); | 2210 EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate)); |
| 2212 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 2211 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 2213 i::Handle<i::Object> name = i::Object::GetProperty( | 2212 i::Handle<i::Object> name = |
| 2214 isolate, self, "scriptNameOrSourceURL").ToHandleChecked(); | 2213 GetProperty(self, "scriptNameOrSourceURL").ToHandleChecked(); |
| 2215 if (!name->IsString()) { | 2214 if (!name->IsString()) { |
| 2216 return Local<String>(); | 2215 return Local<String>(); |
| 2217 } | 2216 } |
| 2218 return scope.Escape(Local<String>::Cast(Utils::ToLocal(name))); | 2217 return scope.Escape(Local<String>::Cast(Utils::ToLocal(name))); |
| 2219 } | 2218 } |
| 2220 | 2219 |
| 2221 | 2220 |
| 2222 Local<String> StackFrame::GetFunctionName() const { | 2221 Local<String> StackFrame::GetFunctionName() const { |
| 2223 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 2222 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 2224 ENTER_V8(isolate); | 2223 ENTER_V8(isolate); |
| 2225 EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate)); | 2224 EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate)); |
| 2226 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 2225 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 2227 i::Handle<i::Object> name = i::Object::GetProperty( | 2226 i::Handle<i::Object> name = |
| 2228 isolate, self, "functionName").ToHandleChecked(); | 2227 GetProperty(self, "functionName").ToHandleChecked(); |
| 2229 if (!name->IsString()) { | 2228 if (!name->IsString()) { |
| 2230 return Local<String>(); | 2229 return Local<String>(); |
| 2231 } | 2230 } |
| 2232 return scope.Escape(Local<String>::Cast(Utils::ToLocal(name))); | 2231 return scope.Escape(Local<String>::Cast(Utils::ToLocal(name))); |
| 2233 } | 2232 } |
| 2234 | 2233 |
| 2235 | 2234 |
| 2236 bool StackFrame::IsEval() const { | 2235 bool StackFrame::IsEval() const { |
| 2237 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 2236 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 2238 ENTER_V8(isolate); | 2237 ENTER_V8(isolate); |
| 2239 i::HandleScope scope(isolate); | 2238 i::HandleScope scope(isolate); |
| 2240 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 2239 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 2241 i::Handle<i::Object> is_eval = i::Object::GetProperty( | 2240 i::Handle<i::Object> is_eval = GetProperty(self, "isEval").ToHandleChecked(); |
| 2242 isolate, self, "isEval").ToHandleChecked(); | |
| 2243 return is_eval->IsTrue(); | 2241 return is_eval->IsTrue(); |
| 2244 } | 2242 } |
| 2245 | 2243 |
| 2246 | 2244 |
| 2247 bool StackFrame::IsConstructor() const { | 2245 bool StackFrame::IsConstructor() const { |
| 2248 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 2246 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 2249 ENTER_V8(isolate); | 2247 ENTER_V8(isolate); |
| 2250 i::HandleScope scope(isolate); | 2248 i::HandleScope scope(isolate); |
| 2251 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 2249 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 2252 i::Handle<i::Object> is_constructor = i::Object::GetProperty( | 2250 i::Handle<i::Object> is_constructor = |
| 2253 isolate, self, "isConstructor").ToHandleChecked(); | 2251 GetProperty(self, "isConstructor").ToHandleChecked(); |
| 2254 return is_constructor->IsTrue(); | 2252 return is_constructor->IsTrue(); |
| 2255 } | 2253 } |
| 2256 | 2254 |
| 2257 | 2255 |
| 2258 // --- J S O N --- | 2256 // --- J S O N --- |
| 2259 | 2257 |
| 2260 Local<Value> JSON::Parse(Local<String> json_string) { | 2258 Local<Value> JSON::Parse(Local<String> json_string) { |
| 2261 i::Handle<i::String> string = Utils::OpenHandle(*json_string); | 2259 i::Handle<i::String> string = Utils::OpenHandle(*json_string); |
| 2262 i::Isolate* isolate = string->GetIsolate(); | 2260 i::Isolate* isolate = string->GetIsolate(); |
| 2263 EnsureInitializedForIsolate(isolate, "v8::JSON::Parse"); | 2261 EnsureInitializedForIsolate(isolate, "v8::JSON::Parse"); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2425 | 2423 |
| 2426 | 2424 |
| 2427 bool Value::IsNumberObject() const { | 2425 bool Value::IsNumberObject() const { |
| 2428 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 2426 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 2429 if (!obj->IsHeapObject()) return false; | 2427 if (!obj->IsHeapObject()) return false; |
| 2430 i::Isolate* isolate = i::HeapObject::cast(*obj)->GetIsolate(); | 2428 i::Isolate* isolate = i::HeapObject::cast(*obj)->GetIsolate(); |
| 2431 return obj->HasSpecificClassOf(isolate->heap()->Number_string()); | 2429 return obj->HasSpecificClassOf(isolate->heap()->Number_string()); |
| 2432 } | 2430 } |
| 2433 | 2431 |
| 2434 | 2432 |
| 2433 static i::Object* LookupBuiltin(i::Isolate* isolate, |
| 2434 const char* builtin_name) { |
| 2435 i::Handle<i::String> string = |
| 2436 isolate->factory()->InternalizeUtf8String(builtin_name); |
| 2437 return *i::Object::GetProperty( |
| 2438 isolate->js_builtins_object(), string).ToHandleChecked(); |
| 2439 } |
| 2440 |
| 2441 |
| 2435 static bool CheckConstructor(i::Isolate* isolate, | 2442 static bool CheckConstructor(i::Isolate* isolate, |
| 2436 i::Handle<i::JSObject> obj, | 2443 i::Handle<i::JSObject> obj, |
| 2437 const char* class_name) { | 2444 const char* class_name) { |
| 2438 i::Handle<i::Object> constr(obj->map()->constructor(), isolate); | 2445 i::Object* constr = obj->map()->constructor(); |
| 2439 if (!constr->IsJSFunction()) return false; | 2446 if (!constr->IsJSFunction()) return false; |
| 2440 i::Handle<i::JSFunction> func = i::Handle<i::JSFunction>::cast(constr); | 2447 i::JSFunction* func = i::JSFunction::cast(constr); |
| 2441 return func->shared()->native() && constr.is_identical_to( | 2448 return func->shared()->native() && |
| 2442 i::Object::GetProperty(isolate, | 2449 constr == LookupBuiltin(isolate, class_name); |
| 2443 isolate->js_builtins_object(), | |
| 2444 class_name).ToHandleChecked()); | |
| 2445 } | 2450 } |
| 2446 | 2451 |
| 2447 | 2452 |
| 2448 bool Value::IsNativeError() const { | 2453 bool Value::IsNativeError() const { |
| 2449 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 2454 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 2450 if (obj->IsJSObject()) { | 2455 if (obj->IsJSObject()) { |
| 2451 i::Handle<i::JSObject> js_obj(i::JSObject::cast(*obj)); | 2456 i::Handle<i::JSObject> js_obj(i::JSObject::cast(*obj)); |
| 2452 i::Isolate* isolate = js_obj->GetIsolate(); | 2457 i::Isolate* isolate = js_obj->GetIsolate(); |
| 2453 return CheckConstructor(isolate, js_obj, "$Error") || | 2458 return CheckConstructor(isolate, js_obj, "$Error") || |
| 2454 CheckConstructor(isolate, js_obj, "$EvalError") || | 2459 CheckConstructor(isolate, js_obj, "$EvalError") || |
| (...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3197 | 3202 |
| 3198 Local<Array> v8::Object::GetPropertyNames() { | 3203 Local<Array> v8::Object::GetPropertyNames() { |
| 3199 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3204 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3200 ON_BAILOUT(isolate, "v8::Object::GetPropertyNames()", | 3205 ON_BAILOUT(isolate, "v8::Object::GetPropertyNames()", |
| 3201 return Local<v8::Array>()); | 3206 return Local<v8::Array>()); |
| 3202 ENTER_V8(isolate); | 3207 ENTER_V8(isolate); |
| 3203 i::HandleScope scope(isolate); | 3208 i::HandleScope scope(isolate); |
| 3204 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3209 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 3205 EXCEPTION_PREAMBLE(isolate); | 3210 EXCEPTION_PREAMBLE(isolate); |
| 3206 i::Handle<i::FixedArray> value; | 3211 i::Handle<i::FixedArray> value; |
| 3207 has_pending_exception = !i::JSReceiver::GetKeys( | 3212 has_pending_exception = |
| 3208 self, i::JSReceiver::INCLUDE_PROTOS).ToHandle(&value); | 3213 !i::GetKeysInFixedArrayFor(self, i::INCLUDE_PROTOS).ToHandle(&value); |
| 3209 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Array>()); | 3214 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Array>()); |
| 3210 // Because we use caching to speed up enumeration it is important | 3215 // Because we use caching to speed up enumeration it is important |
| 3211 // to never change the result of the basic enumeration function so | 3216 // to never change the result of the basic enumeration function so |
| 3212 // we clone the result. | 3217 // we clone the result. |
| 3213 i::Handle<i::FixedArray> elms = isolate->factory()->CopyFixedArray(value); | 3218 i::Handle<i::FixedArray> elms = isolate->factory()->CopyFixedArray(value); |
| 3214 i::Handle<i::JSArray> result = | 3219 i::Handle<i::JSArray> result = |
| 3215 isolate->factory()->NewJSArrayWithElements(elms); | 3220 isolate->factory()->NewJSArrayWithElements(elms); |
| 3216 return Utils::ToLocal(scope.CloseAndEscape(result)); | 3221 return Utils::ToLocal(scope.CloseAndEscape(result)); |
| 3217 } | 3222 } |
| 3218 | 3223 |
| 3219 | 3224 |
| 3220 Local<Array> v8::Object::GetOwnPropertyNames() { | 3225 Local<Array> v8::Object::GetOwnPropertyNames() { |
| 3221 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3226 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3222 ON_BAILOUT(isolate, "v8::Object::GetOwnPropertyNames()", | 3227 ON_BAILOUT(isolate, "v8::Object::GetOwnPropertyNames()", |
| 3223 return Local<v8::Array>()); | 3228 return Local<v8::Array>()); |
| 3224 ENTER_V8(isolate); | 3229 ENTER_V8(isolate); |
| 3225 i::HandleScope scope(isolate); | 3230 i::HandleScope scope(isolate); |
| 3226 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3231 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 3227 EXCEPTION_PREAMBLE(isolate); | 3232 EXCEPTION_PREAMBLE(isolate); |
| 3228 i::Handle<i::FixedArray> value; | 3233 i::Handle<i::FixedArray> value; |
| 3229 has_pending_exception = !i::JSReceiver::GetKeys( | 3234 has_pending_exception = |
| 3230 self, i::JSReceiver::LOCAL_ONLY).ToHandle(&value); | 3235 !i::GetKeysInFixedArrayFor(self, i::LOCAL_ONLY).ToHandle(&value); |
| 3231 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Array>()); | 3236 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Array>()); |
| 3232 // Because we use caching to speed up enumeration it is important | 3237 // Because we use caching to speed up enumeration it is important |
| 3233 // to never change the result of the basic enumeration function so | 3238 // to never change the result of the basic enumeration function so |
| 3234 // we clone the result. | 3239 // we clone the result. |
| 3235 i::Handle<i::FixedArray> elms = isolate->factory()->CopyFixedArray(value); | 3240 i::Handle<i::FixedArray> elms = isolate->factory()->CopyFixedArray(value); |
| 3236 i::Handle<i::JSArray> result = | 3241 i::Handle<i::JSArray> result = |
| 3237 isolate->factory()->NewJSArrayWithElements(elms); | 3242 isolate->factory()->NewJSArrayWithElements(elms); |
| 3238 return Utils::ToLocal(scope.CloseAndEscape(result)); | 3243 return Utils::ToLocal(scope.CloseAndEscape(result)); |
| 3239 } | 3244 } |
| 3240 | 3245 |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4031 } | 4036 } |
| 4032 } | 4037 } |
| 4033 return ToApiHandle<Primitive>(isolate->factory()->undefined_value()); | 4038 return ToApiHandle<Primitive>(isolate->factory()->undefined_value()); |
| 4034 } | 4039 } |
| 4035 | 4040 |
| 4036 | 4041 |
| 4037 ScriptOrigin Function::GetScriptOrigin() const { | 4042 ScriptOrigin Function::GetScriptOrigin() const { |
| 4038 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); | 4043 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); |
| 4039 if (func->shared()->script()->IsScript()) { | 4044 if (func->shared()->script()->IsScript()) { |
| 4040 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); | 4045 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); |
| 4041 i::Handle<i::Object> scriptName = i::Script::GetNameOrSourceURL(script); | 4046 i::Handle<i::Object> scriptName = GetScriptNameOrSourceURL(script); |
| 4042 v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(func->GetIsolate()); | 4047 v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(func->GetIsolate()); |
| 4043 v8::ScriptOrigin origin( | 4048 v8::ScriptOrigin origin( |
| 4044 Utils::ToLocal(scriptName), | 4049 Utils::ToLocal(scriptName), |
| 4045 v8::Integer::New(isolate, script->line_offset()->value()), | 4050 v8::Integer::New(isolate, script->line_offset()->value()), |
| 4046 v8::Integer::New(isolate, script->column_offset()->value())); | 4051 v8::Integer::New(isolate, script->column_offset()->value())); |
| 4047 return origin; | 4052 return origin; |
| 4048 } | 4053 } |
| 4049 return v8::ScriptOrigin(Handle<Value>()); | 4054 return v8::ScriptOrigin(Handle<Value>()); |
| 4050 } | 4055 } |
| 4051 | 4056 |
| 4052 | 4057 |
| 4053 const int Function::kLineOffsetNotFound = -1; | 4058 const int Function::kLineOffsetNotFound = -1; |
| 4054 | 4059 |
| 4055 | 4060 |
| 4056 int Function::GetScriptLineNumber() const { | 4061 int Function::GetScriptLineNumber() const { |
| 4057 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); | 4062 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); |
| 4058 if (func->shared()->script()->IsScript()) { | 4063 if (func->shared()->script()->IsScript()) { |
| 4059 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); | 4064 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); |
| 4060 return i::Script::GetLineNumber(script, func->shared()->start_position()); | 4065 return i::GetScriptLineNumber(script, func->shared()->start_position()); |
| 4061 } | 4066 } |
| 4062 return kLineOffsetNotFound; | 4067 return kLineOffsetNotFound; |
| 4063 } | 4068 } |
| 4064 | 4069 |
| 4065 | 4070 |
| 4066 int Function::GetScriptColumnNumber() const { | 4071 int Function::GetScriptColumnNumber() const { |
| 4067 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); | 4072 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); |
| 4068 if (func->shared()->script()->IsScript()) { | 4073 if (func->shared()->script()->IsScript()) { |
| 4069 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); | 4074 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); |
| 4070 return i::Script::GetColumnNumber(script, func->shared()->start_position()); | 4075 return i::GetScriptColumnNumber(script, func->shared()->start_position()); |
| 4071 } | 4076 } |
| 4072 return kLineOffsetNotFound; | 4077 return kLineOffsetNotFound; |
| 4073 } | 4078 } |
| 4074 | 4079 |
| 4075 | 4080 |
| 4076 bool Function::IsBuiltin() const { | 4081 bool Function::IsBuiltin() const { |
| 4077 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); | 4082 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); |
| 4078 return func->IsBuiltin(); | 4083 return func->IsBuiltin(); |
| 4079 } | 4084 } |
| 4080 | 4085 |
| (...skipping 3528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7609 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7614 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7610 Address callback_address = | 7615 Address callback_address = |
| 7611 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7616 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7612 VMState<EXTERNAL> state(isolate); | 7617 VMState<EXTERNAL> state(isolate); |
| 7613 ExternalCallbackScope call_scope(isolate, callback_address); | 7618 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7614 callback(info); | 7619 callback(info); |
| 7615 } | 7620 } |
| 7616 | 7621 |
| 7617 | 7622 |
| 7618 } } // namespace v8::internal | 7623 } } // namespace v8::internal |
| OLD | NEW |