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