| 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 1689 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1700   // check. |  1700   // check. | 
|  1701   if (this == NULL) return Local<Value>(); |  1701   if (this == NULL) return Local<Value>(); | 
|  1702   i::Handle<i::HeapObject> obj = |  1702   i::Handle<i::HeapObject> obj = | 
|  1703       i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this)); |  1703       i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this)); | 
|  1704   i::Isolate* isolate = obj->GetIsolate(); |  1704   i::Isolate* isolate = obj->GetIsolate(); | 
|  1705   ON_BAILOUT(isolate, "v8::Script::Run()", return Local<Value>()); |  1705   ON_BAILOUT(isolate, "v8::Script::Run()", return Local<Value>()); | 
|  1706   LOG_API(isolate, "Script::Run"); |  1706   LOG_API(isolate, "Script::Run"); | 
|  1707   ENTER_V8(isolate); |  1707   ENTER_V8(isolate); | 
|  1708   i::Logger::TimerEventScope timer_scope( |  1708   i::Logger::TimerEventScope timer_scope( | 
|  1709       isolate, i::Logger::TimerEventScope::v8_execute); |  1709       isolate, i::Logger::TimerEventScope::v8_execute); | 
|  1710   i::Object* raw_result = NULL; |  1710   i::HandleScope scope(isolate); | 
|  1711   { |  1711   i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(obj); | 
|  1712     i::HandleScope scope(isolate); |  1712   EXCEPTION_PREAMBLE(isolate); | 
|  1713     i::Handle<i::JSFunction> fun = |  1713   i::Handle<i::Object> receiver( | 
|  1714         i::Handle<i::JSFunction>(i::JSFunction::cast(*obj), isolate); |  1714       isolate->context()->global_proxy(), isolate); | 
|  1715     EXCEPTION_PREAMBLE(isolate); |  1715   i::Handle<i::Object> result; | 
|  1716     i::Handle<i::Object> receiver( |  1716   has_pending_exception = !i::Execution::Call( | 
|  1717         isolate->context()->global_proxy(), isolate); |  1717       isolate, fun, receiver, 0, NULL).ToHandle(&result); | 
|  1718     i::Handle<i::Object> result = i::Execution::Call( |  1718   EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<Value>()); | 
|  1719         isolate, fun, receiver, 0, NULL, &has_pending_exception); |  1719   return Utils::ToLocal(scope.CloseAndEscape(result)); | 
|  1720     EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<Value>()); |  | 
|  1721     raw_result = *result; |  | 
|  1722   } |  | 
|  1723   i::Handle<i::Object> result(raw_result, isolate); |  | 
|  1724   return Utils::ToLocal(result); |  | 
|  1725 } |  1720 } | 
|  1726  |  1721  | 
|  1727  |  1722  | 
|  1728 Local<UnboundScript> Script::GetUnboundScript() { |  1723 Local<UnboundScript> Script::GetUnboundScript() { | 
|  1729   i::Handle<i::Object> obj = Utils::OpenHandle(this); |  1724   i::Handle<i::Object> obj = Utils::OpenHandle(this); | 
|  1730   return ToApiHandle<UnboundScript>( |  1725   return ToApiHandle<UnboundScript>( | 
|  1731       i::Handle<i::SharedFunctionInfo>(i::JSFunction::cast(*obj)->shared())); |  1726       i::Handle<i::SharedFunctionInfo>(i::JSFunction::cast(*obj)->shared())); | 
|  1732 } |  1727 } | 
|  1733  |  1728  | 
|  1734  |  1729  | 
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2033   i::Handle<i::JSMessageObject> message = |  2028   i::Handle<i::JSMessageObject> message = | 
|  2034       i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this)); |  2029       i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this)); | 
|  2035   i::Handle<i::Object> stackFramesObj(message->stack_frames(), isolate); |  2030   i::Handle<i::Object> stackFramesObj(message->stack_frames(), isolate); | 
|  2036   if (!stackFramesObj->IsJSArray()) return v8::Handle<v8::StackTrace>(); |  2031   if (!stackFramesObj->IsJSArray()) return v8::Handle<v8::StackTrace>(); | 
|  2037   i::Handle<i::JSArray> stackTrace = |  2032   i::Handle<i::JSArray> stackTrace = | 
|  2038       i::Handle<i::JSArray>::cast(stackFramesObj); |  2033       i::Handle<i::JSArray>::cast(stackFramesObj); | 
|  2039   return scope.Escape(Utils::StackTraceToLocal(stackTrace)); |  2034   return scope.Escape(Utils::StackTraceToLocal(stackTrace)); | 
|  2040 } |  2035 } | 
|  2041  |  2036  | 
|  2042  |  2037  | 
|  2043 static i::Handle<i::Object> CallV8HeapFunction(const char* name, |  2038 MUST_USE_RESULT static i::MaybeHandle<i::Object> CallV8HeapFunction( | 
|  2044                                                i::Handle<i::Object> recv, |  2039     const char* name, | 
|  2045                                                int argc, |  2040     i::Handle<i::Object> recv, | 
|  2046                                                i::Handle<i::Object> argv[], |  2041     int argc, | 
|  2047                                                bool* has_pending_exception) { |  2042     i::Handle<i::Object> argv[]) { | 
|  2048   i::Isolate* isolate = i::Isolate::Current(); |  2043   i::Isolate* isolate = i::Isolate::Current(); | 
|  2049   i::Handle<i::String> fmt_str = |  2044   i::Handle<i::String> fmt_str = | 
|  2050       isolate->factory()->InternalizeUtf8String(name); |  2045       isolate->factory()->InternalizeUtf8String(name); | 
|  2051   i::Handle<i::Object> object_fun = |  2046   i::Handle<i::Object> object_fun = | 
|  2052       i::GlobalObject::GetPropertyNoExceptionThrown( |  2047       i::GlobalObject::GetPropertyNoExceptionThrown( | 
|  2053           isolate->js_builtins_object(), fmt_str); |  2048           isolate->js_builtins_object(), fmt_str); | 
|  2054   i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(object_fun); |  2049   i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(object_fun); | 
|  2055   i::Handle<i::Object> value = i::Execution::Call( |  2050   return i::Execution::Call(isolate, fun, recv, argc, argv); | 
|  2056       isolate, fun, recv, argc, argv, has_pending_exception); |  | 
|  2057   return value; |  | 
|  2058 } |  2051 } | 
|  2059  |  2052  | 
|  2060  |  2053  | 
|  2061 static i::Handle<i::Object> CallV8HeapFunction(const char* name, |  2054 MUST_USE_RESULT static i::MaybeHandle<i::Object> CallV8HeapFunction( | 
|  2062                                                i::Handle<i::Object> data, |  2055     const char* name, | 
|  2063                                                bool* has_pending_exception) { |  2056     i::Handle<i::Object> data) { | 
|  2064   i::Handle<i::Object> argv[] = { data }; |  2057   i::Handle<i::Object> argv[] = { data }; | 
|  2065   return CallV8HeapFunction(name, |  2058   return CallV8HeapFunction(name, | 
|  2066                             i::Isolate::Current()->js_builtins_object(), |  2059                             i::Isolate::Current()->js_builtins_object(), | 
|  2067                             ARRAY_SIZE(argv), |  2060                             ARRAY_SIZE(argv), | 
|  2068                             argv, |  2061                             argv); | 
|  2069                             has_pending_exception); |  | 
|  2070 } |  2062 } | 
|  2071  |  2063  | 
|  2072  |  2064  | 
|  2073 int Message::GetLineNumber() const { |  2065 int Message::GetLineNumber() const { | 
|  2074   i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |  2066   i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 
|  2075   ON_BAILOUT(isolate, "v8::Message::GetLineNumber()", return kNoLineNumberInfo); |  2067   ON_BAILOUT(isolate, "v8::Message::GetLineNumber()", return kNoLineNumberInfo); | 
|  2076   ENTER_V8(isolate); |  2068   ENTER_V8(isolate); | 
|  2077   i::HandleScope scope(isolate); |  2069   i::HandleScope scope(isolate); | 
|  2078  |  2070  | 
|  2079   EXCEPTION_PREAMBLE(isolate); |  2071   EXCEPTION_PREAMBLE(isolate); | 
|  2080   i::Handle<i::Object> result = CallV8HeapFunction("GetLineNumber", |  2072   i::Handle<i::Object> result; | 
|  2081                                                    Utils::OpenHandle(this), |  2073   has_pending_exception = !CallV8HeapFunction( | 
|  2082                                                    &has_pending_exception); |  2074       "GetLineNumber", Utils::OpenHandle(this)).ToHandle(&result); | 
|  2083   EXCEPTION_BAILOUT_CHECK(isolate, 0); |  2075   EXCEPTION_BAILOUT_CHECK(isolate, 0); | 
|  2084   return static_cast<int>(result->Number()); |  2076   return static_cast<int>(result->Number()); | 
|  2085 } |  2077 } | 
|  2086  |  2078  | 
|  2087  |  2079  | 
|  2088 int Message::GetStartPosition() const { |  2080 int Message::GetStartPosition() const { | 
|  2089   i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |  2081   i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 
|  2090   ENTER_V8(isolate); |  2082   ENTER_V8(isolate); | 
|  2091   i::HandleScope scope(isolate); |  2083   i::HandleScope scope(isolate); | 
|  2092   i::Handle<i::JSMessageObject> message = |  2084   i::Handle<i::JSMessageObject> message = | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
|  2104   return message->end_position(); |  2096   return message->end_position(); | 
|  2105 } |  2097 } | 
|  2106  |  2098  | 
|  2107  |  2099  | 
|  2108 int Message::GetStartColumn() const { |  2100 int Message::GetStartColumn() const { | 
|  2109   i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |  2101   i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 
|  2110   ENTER_V8(isolate); |  2102   ENTER_V8(isolate); | 
|  2111   i::HandleScope scope(isolate); |  2103   i::HandleScope scope(isolate); | 
|  2112   i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this); |  2104   i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this); | 
|  2113   EXCEPTION_PREAMBLE(isolate); |  2105   EXCEPTION_PREAMBLE(isolate); | 
|  2114   i::Handle<i::Object> start_col_obj = CallV8HeapFunction( |  2106   i::Handle<i::Object> start_col_obj; | 
|  2115       "GetPositionInLine", |  2107   has_pending_exception = !CallV8HeapFunction( | 
|  2116       data_obj, |  2108       "GetPositionInLine", data_obj).ToHandle(&start_col_obj); | 
|  2117       &has_pending_exception); |  | 
|  2118   EXCEPTION_BAILOUT_CHECK(isolate, 0); |  2109   EXCEPTION_BAILOUT_CHECK(isolate, 0); | 
|  2119   return static_cast<int>(start_col_obj->Number()); |  2110   return static_cast<int>(start_col_obj->Number()); | 
|  2120 } |  2111 } | 
|  2121  |  2112  | 
|  2122  |  2113  | 
|  2123 int Message::GetEndColumn() const { |  2114 int Message::GetEndColumn() const { | 
|  2124   i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |  2115   i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 
|  2125   ENTER_V8(isolate); |  2116   ENTER_V8(isolate); | 
|  2126   i::HandleScope scope(isolate); |  2117   i::HandleScope scope(isolate); | 
|  2127   i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this); |  2118   i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this); | 
|  2128   EXCEPTION_PREAMBLE(isolate); |  2119   EXCEPTION_PREAMBLE(isolate); | 
|  2129   i::Handle<i::Object> start_col_obj = CallV8HeapFunction( |  2120   i::Handle<i::Object> start_col_obj; | 
|  2130       "GetPositionInLine", |  2121   has_pending_exception = !CallV8HeapFunction( | 
|  2131       data_obj, |  2122       "GetPositionInLine", data_obj).ToHandle(&start_col_obj); | 
|  2132       &has_pending_exception); |  | 
|  2133   EXCEPTION_BAILOUT_CHECK(isolate, 0); |  2123   EXCEPTION_BAILOUT_CHECK(isolate, 0); | 
|  2134   i::Handle<i::JSMessageObject> message = |  2124   i::Handle<i::JSMessageObject> message = | 
|  2135       i::Handle<i::JSMessageObject>::cast(data_obj); |  2125       i::Handle<i::JSMessageObject>::cast(data_obj); | 
|  2136   int start = message->start_position(); |  2126   int start = message->start_position(); | 
|  2137   int end = message->end_position(); |  2127   int end = message->end_position(); | 
|  2138   return static_cast<int>(start_col_obj->Number()) + (end - start); |  2128   return static_cast<int>(start_col_obj->Number()) + (end - start); | 
|  2139 } |  2129 } | 
|  2140  |  2130  | 
|  2141  |  2131  | 
|  2142 bool Message::IsSharedCrossOrigin() const { |  2132 bool Message::IsSharedCrossOrigin() const { | 
|  2143   i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |  2133   i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 
|  2144   ENTER_V8(isolate); |  2134   ENTER_V8(isolate); | 
|  2145   i::HandleScope scope(isolate); |  2135   i::HandleScope scope(isolate); | 
|  2146   i::Handle<i::JSMessageObject> message = |  2136   i::Handle<i::JSMessageObject> message = | 
|  2147       i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this)); |  2137       i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this)); | 
|  2148   i::Handle<i::JSValue> script = |  2138   i::Handle<i::JSValue> script = | 
|  2149       i::Handle<i::JSValue>::cast(i::Handle<i::Object>(message->script(), |  2139       i::Handle<i::JSValue>::cast(i::Handle<i::Object>(message->script(), | 
|  2150                                                        isolate)); |  2140                                                        isolate)); | 
|  2151   return i::Script::cast(script->value())->is_shared_cross_origin(); |  2141   return i::Script::cast(script->value())->is_shared_cross_origin(); | 
|  2152 } |  2142 } | 
|  2153  |  2143  | 
|  2154  |  2144  | 
|  2155 Local<String> Message::GetSourceLine() const { |  2145 Local<String> Message::GetSourceLine() const { | 
|  2156   i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |  2146   i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 
|  2157   ON_BAILOUT(isolate, "v8::Message::GetSourceLine()", return Local<String>()); |  2147   ON_BAILOUT(isolate, "v8::Message::GetSourceLine()", return Local<String>()); | 
|  2158   ENTER_V8(isolate); |  2148   ENTER_V8(isolate); | 
|  2159   EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate)); |  2149   EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate)); | 
|  2160   EXCEPTION_PREAMBLE(isolate); |  2150   EXCEPTION_PREAMBLE(isolate); | 
|  2161   i::Handle<i::Object> result = CallV8HeapFunction("GetSourceLine", |  2151   i::Handle<i::Object> result; | 
|  2162                                                    Utils::OpenHandle(this), |  2152   has_pending_exception = !CallV8HeapFunction( | 
|  2163                                                    &has_pending_exception); |  2153       "GetSourceLine", Utils::OpenHandle(this)).ToHandle(&result); | 
|  2164   EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::String>()); |  2154   EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::String>()); | 
|  2165   if (result->IsString()) { |  2155   if (result->IsString()) { | 
|  2166     return scope.Escape(Utils::ToLocal(i::Handle<i::String>::cast(result))); |  2156     return scope.Escape(Utils::ToLocal(i::Handle<i::String>::cast(result))); | 
|  2167   } else { |  2157   } else { | 
|  2168     return Local<String>(); |  2158     return Local<String>(); | 
|  2169   } |  2159   } | 
|  2170 } |  2160 } | 
|  2171  |  2161  | 
|  2172  |  2162  | 
|  2173 void Message::PrintCurrentStackTrace(Isolate* isolate, FILE* out) { |  2163 void Message::PrintCurrentStackTrace(Isolate* isolate, FILE* out) { | 
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2550 Local<String> Value::ToString() const { |  2540 Local<String> Value::ToString() const { | 
|  2551   i::Handle<i::Object> obj = Utils::OpenHandle(this); |  2541   i::Handle<i::Object> obj = Utils::OpenHandle(this); | 
|  2552   i::Handle<i::Object> str; |  2542   i::Handle<i::Object> str; | 
|  2553   if (obj->IsString()) { |  2543   if (obj->IsString()) { | 
|  2554     str = obj; |  2544     str = obj; | 
|  2555   } else { |  2545   } else { | 
|  2556     i::Isolate* isolate = i::Isolate::Current(); |  2546     i::Isolate* isolate = i::Isolate::Current(); | 
|  2557     LOG_API(isolate, "ToString"); |  2547     LOG_API(isolate, "ToString"); | 
|  2558     ENTER_V8(isolate); |  2548     ENTER_V8(isolate); | 
|  2559     EXCEPTION_PREAMBLE(isolate); |  2549     EXCEPTION_PREAMBLE(isolate); | 
|  2560     str = i::Execution::ToString(isolate, obj, &has_pending_exception); |  2550     has_pending_exception = !i::Execution::ToString( | 
 |  2551         isolate, obj).ToHandle(&str); | 
|  2561     EXCEPTION_BAILOUT_CHECK(isolate, Local<String>()); |  2552     EXCEPTION_BAILOUT_CHECK(isolate, Local<String>()); | 
|  2562   } |  2553   } | 
|  2563   return ToApiHandle<String>(str); |  2554   return ToApiHandle<String>(str); | 
|  2564 } |  2555 } | 
|  2565  |  2556  | 
|  2566  |  2557  | 
|  2567 Local<String> Value::ToDetailString() const { |  2558 Local<String> Value::ToDetailString() const { | 
|  2568   i::Handle<i::Object> obj = Utils::OpenHandle(this); |  2559   i::Handle<i::Object> obj = Utils::OpenHandle(this); | 
|  2569   i::Handle<i::Object> str; |  2560   i::Handle<i::Object> str; | 
|  2570   if (obj->IsString()) { |  2561   if (obj->IsString()) { | 
|  2571     str = obj; |  2562     str = obj; | 
|  2572   } else { |  2563   } else { | 
|  2573     i::Isolate* isolate = i::Isolate::Current(); |  2564     i::Isolate* isolate = i::Isolate::Current(); | 
|  2574     LOG_API(isolate, "ToDetailString"); |  2565     LOG_API(isolate, "ToDetailString"); | 
|  2575     ENTER_V8(isolate); |  2566     ENTER_V8(isolate); | 
|  2576     EXCEPTION_PREAMBLE(isolate); |  2567     EXCEPTION_PREAMBLE(isolate); | 
|  2577     str = i::Execution::ToDetailString(isolate, obj, &has_pending_exception); |  2568     has_pending_exception = !i::Execution::ToDetailString( | 
 |  2569         isolate, obj).ToHandle(&str); | 
|  2578     EXCEPTION_BAILOUT_CHECK(isolate, Local<String>()); |  2570     EXCEPTION_BAILOUT_CHECK(isolate, Local<String>()); | 
|  2579   } |  2571   } | 
|  2580   return ToApiHandle<String>(str); |  2572   return ToApiHandle<String>(str); | 
|  2581 } |  2573 } | 
|  2582  |  2574  | 
|  2583  |  2575  | 
|  2584 Local<v8::Object> Value::ToObject() const { |  2576 Local<v8::Object> Value::ToObject() const { | 
|  2585   i::Handle<i::Object> obj = Utils::OpenHandle(this); |  2577   i::Handle<i::Object> obj = Utils::OpenHandle(this); | 
|  2586   i::Handle<i::Object> val; |  2578   i::Handle<i::Object> val; | 
|  2587   if (obj->IsJSObject()) { |  2579   if (obj->IsJSObject()) { | 
|  2588     val = obj; |  2580     val = obj; | 
|  2589   } else { |  2581   } else { | 
|  2590     i::Isolate* isolate = i::Isolate::Current(); |  2582     i::Isolate* isolate = i::Isolate::Current(); | 
|  2591     LOG_API(isolate, "ToObject"); |  2583     LOG_API(isolate, "ToObject"); | 
|  2592     ENTER_V8(isolate); |  2584     ENTER_V8(isolate); | 
|  2593     EXCEPTION_PREAMBLE(isolate); |  2585     EXCEPTION_PREAMBLE(isolate); | 
|  2594     val = i::Execution::ToObject(isolate, obj, &has_pending_exception); |  2586     has_pending_exception = !i::Execution::ToObject( | 
 |  2587         isolate, obj).ToHandle(&val); | 
|  2595     EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Object>()); |  2588     EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Object>()); | 
|  2596   } |  2589   } | 
|  2597   return ToApiHandle<Object>(val); |  2590   return ToApiHandle<Object>(val); | 
|  2598 } |  2591 } | 
|  2599  |  2592  | 
|  2600  |  2593  | 
|  2601 Local<Boolean> Value::ToBoolean() const { |  2594 Local<Boolean> Value::ToBoolean() const { | 
|  2602   i::Handle<i::Object> obj = Utils::OpenHandle(this); |  2595   i::Handle<i::Object> obj = Utils::OpenHandle(this); | 
|  2603   if (obj->IsBoolean()) { |  2596   if (obj->IsBoolean()) { | 
|  2604     return ToApiHandle<Boolean>(obj); |  2597     return ToApiHandle<Boolean>(obj); | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
|  2616 Local<Number> Value::ToNumber() const { |  2609 Local<Number> Value::ToNumber() const { | 
|  2617   i::Handle<i::Object> obj = Utils::OpenHandle(this); |  2610   i::Handle<i::Object> obj = Utils::OpenHandle(this); | 
|  2618   i::Handle<i::Object> num; |  2611   i::Handle<i::Object> num; | 
|  2619   if (obj->IsNumber()) { |  2612   if (obj->IsNumber()) { | 
|  2620     num = obj; |  2613     num = obj; | 
|  2621   } else { |  2614   } else { | 
|  2622     i::Isolate* isolate = i::Isolate::Current(); |  2615     i::Isolate* isolate = i::Isolate::Current(); | 
|  2623     LOG_API(isolate, "ToNumber"); |  2616     LOG_API(isolate, "ToNumber"); | 
|  2624     ENTER_V8(isolate); |  2617     ENTER_V8(isolate); | 
|  2625     EXCEPTION_PREAMBLE(isolate); |  2618     EXCEPTION_PREAMBLE(isolate); | 
|  2626     num = i::Execution::ToNumber(isolate, obj, &has_pending_exception); |  2619     has_pending_exception = !i::Execution::ToNumber( | 
 |  2620         isolate, obj).ToHandle(&num); | 
|  2627     EXCEPTION_BAILOUT_CHECK(isolate, Local<Number>()); |  2621     EXCEPTION_BAILOUT_CHECK(isolate, Local<Number>()); | 
|  2628   } |  2622   } | 
|  2629   return ToApiHandle<Number>(num); |  2623   return ToApiHandle<Number>(num); | 
|  2630 } |  2624 } | 
|  2631  |  2625  | 
|  2632  |  2626  | 
|  2633 Local<Integer> Value::ToInteger() const { |  2627 Local<Integer> Value::ToInteger() const { | 
|  2634   i::Handle<i::Object> obj = Utils::OpenHandle(this); |  2628   i::Handle<i::Object> obj = Utils::OpenHandle(this); | 
|  2635   i::Handle<i::Object> num; |  2629   i::Handle<i::Object> num; | 
|  2636   if (obj->IsSmi()) { |  2630   if (obj->IsSmi()) { | 
|  2637     num = obj; |  2631     num = obj; | 
|  2638   } else { |  2632   } else { | 
|  2639     i::Isolate* isolate = i::Isolate::Current(); |  2633     i::Isolate* isolate = i::Isolate::Current(); | 
|  2640     LOG_API(isolate, "ToInteger"); |  2634     LOG_API(isolate, "ToInteger"); | 
|  2641     ENTER_V8(isolate); |  2635     ENTER_V8(isolate); | 
|  2642     EXCEPTION_PREAMBLE(isolate); |  2636     EXCEPTION_PREAMBLE(isolate); | 
|  2643     num = i::Execution::ToInteger(isolate, obj, &has_pending_exception); |  2637     has_pending_exception = !i::Execution::ToInteger( | 
 |  2638         isolate, obj).ToHandle(&num); | 
|  2644     EXCEPTION_BAILOUT_CHECK(isolate, Local<Integer>()); |  2639     EXCEPTION_BAILOUT_CHECK(isolate, Local<Integer>()); | 
|  2645   } |  2640   } | 
|  2646   return ToApiHandle<Integer>(num); |  2641   return ToApiHandle<Integer>(num); | 
|  2647 } |  2642 } | 
|  2648  |  2643  | 
|  2649  |  2644  | 
|  2650 void i::Internals::CheckInitializedImpl(v8::Isolate* external_isolate) { |  2645 void i::Internals::CheckInitializedImpl(v8::Isolate* external_isolate) { | 
|  2651   i::Isolate* isolate = reinterpret_cast<i::Isolate*>(external_isolate); |  2646   i::Isolate* isolate = reinterpret_cast<i::Isolate*>(external_isolate); | 
|  2652   Utils::ApiCheck(isolate != NULL && |  2647   Utils::ApiCheck(isolate != NULL && | 
|  2653                   isolate->IsInitialized() && |  2648                   isolate->IsInitialized() && | 
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2843 double Value::NumberValue() const { |  2838 double Value::NumberValue() const { | 
|  2844   i::Handle<i::Object> obj = Utils::OpenHandle(this); |  2839   i::Handle<i::Object> obj = Utils::OpenHandle(this); | 
|  2845   i::Handle<i::Object> num; |  2840   i::Handle<i::Object> num; | 
|  2846   if (obj->IsNumber()) { |  2841   if (obj->IsNumber()) { | 
|  2847     num = obj; |  2842     num = obj; | 
|  2848   } else { |  2843   } else { | 
|  2849     i::Isolate* isolate = i::Isolate::Current(); |  2844     i::Isolate* isolate = i::Isolate::Current(); | 
|  2850     LOG_API(isolate, "NumberValue"); |  2845     LOG_API(isolate, "NumberValue"); | 
|  2851     ENTER_V8(isolate); |  2846     ENTER_V8(isolate); | 
|  2852     EXCEPTION_PREAMBLE(isolate); |  2847     EXCEPTION_PREAMBLE(isolate); | 
|  2853     num = i::Execution::ToNumber(isolate, obj, &has_pending_exception); |  2848     has_pending_exception = !i::Execution::ToNumber( | 
 |  2849         isolate, obj).ToHandle(&num); | 
|  2854     EXCEPTION_BAILOUT_CHECK(isolate, i::OS::nan_value()); |  2850     EXCEPTION_BAILOUT_CHECK(isolate, i::OS::nan_value()); | 
|  2855   } |  2851   } | 
|  2856   return num->Number(); |  2852   return num->Number(); | 
|  2857 } |  2853 } | 
|  2858  |  2854  | 
|  2859  |  2855  | 
|  2860 int64_t Value::IntegerValue() const { |  2856 int64_t Value::IntegerValue() const { | 
|  2861   i::Handle<i::Object> obj = Utils::OpenHandle(this); |  2857   i::Handle<i::Object> obj = Utils::OpenHandle(this); | 
|  2862   i::Handle<i::Object> num; |  2858   i::Handle<i::Object> num; | 
|  2863   if (obj->IsNumber()) { |  2859   if (obj->IsNumber()) { | 
|  2864     num = obj; |  2860     num = obj; | 
|  2865   } else { |  2861   } else { | 
|  2866     i::Isolate* isolate = i::Isolate::Current(); |  2862     i::Isolate* isolate = i::Isolate::Current(); | 
|  2867     LOG_API(isolate, "IntegerValue"); |  2863     LOG_API(isolate, "IntegerValue"); | 
|  2868     ENTER_V8(isolate); |  2864     ENTER_V8(isolate); | 
|  2869     EXCEPTION_PREAMBLE(isolate); |  2865     EXCEPTION_PREAMBLE(isolate); | 
|  2870     num = i::Execution::ToInteger(isolate, obj, &has_pending_exception); |  2866     has_pending_exception = !i::Execution::ToInteger( | 
 |  2867         isolate, obj).ToHandle(&num); | 
|  2871     EXCEPTION_BAILOUT_CHECK(isolate, 0); |  2868     EXCEPTION_BAILOUT_CHECK(isolate, 0); | 
|  2872   } |  2869   } | 
|  2873   if (num->IsSmi()) { |  2870   if (num->IsSmi()) { | 
|  2874     return i::Smi::cast(*num)->value(); |  2871     return i::Smi::cast(*num)->value(); | 
|  2875   } else { |  2872   } else { | 
|  2876     return static_cast<int64_t>(num->Number()); |  2873     return static_cast<int64_t>(num->Number()); | 
|  2877   } |  2874   } | 
|  2878 } |  2875 } | 
|  2879  |  2876  | 
|  2880  |  2877  | 
|  2881 Local<Int32> Value::ToInt32() const { |  2878 Local<Int32> Value::ToInt32() const { | 
|  2882   i::Handle<i::Object> obj = Utils::OpenHandle(this); |  2879   i::Handle<i::Object> obj = Utils::OpenHandle(this); | 
|  2883   i::Handle<i::Object> num; |  2880   i::Handle<i::Object> num; | 
|  2884   if (obj->IsSmi()) { |  2881   if (obj->IsSmi()) { | 
|  2885     num = obj; |  2882     num = obj; | 
|  2886   } else { |  2883   } else { | 
|  2887     i::Isolate* isolate = i::Isolate::Current(); |  2884     i::Isolate* isolate = i::Isolate::Current(); | 
|  2888     LOG_API(isolate, "ToInt32"); |  2885     LOG_API(isolate, "ToInt32"); | 
|  2889     ENTER_V8(isolate); |  2886     ENTER_V8(isolate); | 
|  2890     EXCEPTION_PREAMBLE(isolate); |  2887     EXCEPTION_PREAMBLE(isolate); | 
|  2891     num = i::Execution::ToInt32(isolate, obj, &has_pending_exception); |  2888     has_pending_exception = !i::Execution::ToInt32(isolate, obj).ToHandle(&num); | 
|  2892     EXCEPTION_BAILOUT_CHECK(isolate, Local<Int32>()); |  2889     EXCEPTION_BAILOUT_CHECK(isolate, Local<Int32>()); | 
|  2893   } |  2890   } | 
|  2894   return ToApiHandle<Int32>(num); |  2891   return ToApiHandle<Int32>(num); | 
|  2895 } |  2892 } | 
|  2896  |  2893  | 
|  2897  |  2894  | 
|  2898 Local<Uint32> Value::ToUint32() const { |  2895 Local<Uint32> Value::ToUint32() const { | 
|  2899   i::Handle<i::Object> obj = Utils::OpenHandle(this); |  2896   i::Handle<i::Object> obj = Utils::OpenHandle(this); | 
|  2900   i::Handle<i::Object> num; |  2897   i::Handle<i::Object> num; | 
|  2901   if (obj->IsSmi()) { |  2898   if (obj->IsSmi()) { | 
|  2902     num = obj; |  2899     num = obj; | 
|  2903   } else { |  2900   } else { | 
|  2904     i::Isolate* isolate = i::Isolate::Current(); |  2901     i::Isolate* isolate = i::Isolate::Current(); | 
|  2905     LOG_API(isolate, "ToUInt32"); |  2902     LOG_API(isolate, "ToUInt32"); | 
|  2906     ENTER_V8(isolate); |  2903     ENTER_V8(isolate); | 
|  2907     EXCEPTION_PREAMBLE(isolate); |  2904     EXCEPTION_PREAMBLE(isolate); | 
|  2908     num = i::Execution::ToUint32(isolate, obj, &has_pending_exception); |  2905     has_pending_exception = !i::Execution::ToUint32( | 
 |  2906         isolate, obj).ToHandle(&num); | 
|  2909     EXCEPTION_BAILOUT_CHECK(isolate, Local<Uint32>()); |  2907     EXCEPTION_BAILOUT_CHECK(isolate, Local<Uint32>()); | 
|  2910   } |  2908   } | 
|  2911   return ToApiHandle<Uint32>(num); |  2909   return ToApiHandle<Uint32>(num); | 
|  2912 } |  2910 } | 
|  2913  |  2911  | 
|  2914  |  2912  | 
|  2915 Local<Uint32> Value::ToArrayIndex() const { |  2913 Local<Uint32> Value::ToArrayIndex() const { | 
|  2916   i::Handle<i::Object> obj = Utils::OpenHandle(this); |  2914   i::Handle<i::Object> obj = Utils::OpenHandle(this); | 
|  2917   if (obj->IsSmi()) { |  2915   if (obj->IsSmi()) { | 
|  2918     if (i::Smi::cast(*obj)->value() >= 0) return Utils::Uint32ToLocal(obj); |  2916     if (i::Smi::cast(*obj)->value() >= 0) return Utils::Uint32ToLocal(obj); | 
|  2919     return Local<Uint32>(); |  2917     return Local<Uint32>(); | 
|  2920   } |  2918   } | 
|  2921   i::Isolate* isolate = i::Isolate::Current(); |  2919   i::Isolate* isolate = i::Isolate::Current(); | 
|  2922   LOG_API(isolate, "ToArrayIndex"); |  2920   LOG_API(isolate, "ToArrayIndex"); | 
|  2923   ENTER_V8(isolate); |  2921   ENTER_V8(isolate); | 
|  2924   EXCEPTION_PREAMBLE(isolate); |  2922   EXCEPTION_PREAMBLE(isolate); | 
|  2925   i::Handle<i::Object> string_obj = |  2923   i::Handle<i::Object> string_obj; | 
|  2926       i::Execution::ToString(isolate, obj, &has_pending_exception); |  2924   has_pending_exception = !i::Execution::ToString( | 
 |  2925       isolate, obj).ToHandle(&string_obj); | 
|  2927   EXCEPTION_BAILOUT_CHECK(isolate, Local<Uint32>()); |  2926   EXCEPTION_BAILOUT_CHECK(isolate, Local<Uint32>()); | 
|  2928   i::Handle<i::String> str = i::Handle<i::String>::cast(string_obj); |  2927   i::Handle<i::String> str = i::Handle<i::String>::cast(string_obj); | 
|  2929   uint32_t index; |  2928   uint32_t index; | 
|  2930   if (str->AsArrayIndex(&index)) { |  2929   if (str->AsArrayIndex(&index)) { | 
|  2931     i::Handle<i::Object> value; |  2930     i::Handle<i::Object> value; | 
|  2932     if (index <= static_cast<uint32_t>(i::Smi::kMaxValue)) { |  2931     if (index <= static_cast<uint32_t>(i::Smi::kMaxValue)) { | 
|  2933       value = i::Handle<i::Object>(i::Smi::FromInt(index), isolate); |  2932       value = i::Handle<i::Object>(i::Smi::FromInt(index), isolate); | 
|  2934     } else { |  2933     } else { | 
|  2935       value = isolate->factory()->NewNumber(index); |  2934       value = isolate->factory()->NewNumber(index); | 
|  2936     } |  2935     } | 
|  2937     return Utils::Uint32ToLocal(value); |  2936     return Utils::Uint32ToLocal(value); | 
|  2938   } |  2937   } | 
|  2939   return Local<Uint32>(); |  2938   return Local<Uint32>(); | 
|  2940 } |  2939 } | 
|  2941  |  2940  | 
|  2942  |  2941  | 
|  2943 int32_t Value::Int32Value() const { |  2942 int32_t Value::Int32Value() const { | 
|  2944   i::Handle<i::Object> obj = Utils::OpenHandle(this); |  2943   i::Handle<i::Object> obj = Utils::OpenHandle(this); | 
|  2945   if (obj->IsSmi()) { |  2944   if (obj->IsSmi()) { | 
|  2946     return i::Smi::cast(*obj)->value(); |  2945     return i::Smi::cast(*obj)->value(); | 
|  2947   } else { |  2946   } else { | 
|  2948     i::Isolate* isolate = i::Isolate::Current(); |  2947     i::Isolate* isolate = i::Isolate::Current(); | 
|  2949     LOG_API(isolate, "Int32Value (slow)"); |  2948     LOG_API(isolate, "Int32Value (slow)"); | 
|  2950     ENTER_V8(isolate); |  2949     ENTER_V8(isolate); | 
|  2951     EXCEPTION_PREAMBLE(isolate); |  2950     EXCEPTION_PREAMBLE(isolate); | 
|  2952     i::Handle<i::Object> num = |  2951     i::Handle<i::Object> num; | 
|  2953         i::Execution::ToInt32(isolate, obj, &has_pending_exception); |  2952     has_pending_exception = !i::Execution::ToInt32(isolate, obj).ToHandle(&num); | 
|  2954     EXCEPTION_BAILOUT_CHECK(isolate, 0); |  2953     EXCEPTION_BAILOUT_CHECK(isolate, 0); | 
|  2955     if (num->IsSmi()) { |  2954     if (num->IsSmi()) { | 
|  2956       return i::Smi::cast(*num)->value(); |  2955       return i::Smi::cast(*num)->value(); | 
|  2957     } else { |  2956     } else { | 
|  2958       return static_cast<int32_t>(num->Number()); |  2957       return static_cast<int32_t>(num->Number()); | 
|  2959     } |  2958     } | 
|  2960   } |  2959   } | 
|  2961 } |  2960 } | 
|  2962  |  2961  | 
|  2963  |  2962  | 
|  2964 bool Value::Equals(Handle<Value> that) const { |  2963 bool Value::Equals(Handle<Value> that) const { | 
|  2965   i::Isolate* isolate = i::Isolate::Current(); |  2964   i::Isolate* isolate = i::Isolate::Current(); | 
|  2966   if (!Utils::ApiCheck(this != NULL && !that.IsEmpty(), |  2965   if (!Utils::ApiCheck(this != NULL && !that.IsEmpty(), | 
|  2967                        "v8::Value::Equals()", |  2966                        "v8::Value::Equals()", | 
|  2968                        "Reading from empty handle")) { |  2967                        "Reading from empty handle")) { | 
|  2969     return false; |  2968     return false; | 
|  2970   } |  2969   } | 
|  2971   LOG_API(isolate, "Equals"); |  2970   LOG_API(isolate, "Equals"); | 
|  2972   ENTER_V8(isolate); |  2971   ENTER_V8(isolate); | 
|  2973   i::Handle<i::Object> obj = Utils::OpenHandle(this); |  2972   i::Handle<i::Object> obj = Utils::OpenHandle(this); | 
|  2974   i::Handle<i::Object> other = Utils::OpenHandle(*that); |  2973   i::Handle<i::Object> other = Utils::OpenHandle(*that); | 
|  2975   // If both obj and other are JSObjects, we'd better compare by identity |  2974   // If both obj and other are JSObjects, we'd better compare by identity | 
|  2976   // immediately when going into JS builtin.  The reason is Invoke |  2975   // immediately when going into JS builtin.  The reason is Invoke | 
|  2977   // would overwrite global object receiver with global proxy. |  2976   // would overwrite global object receiver with global proxy. | 
|  2978   if (obj->IsJSObject() && other->IsJSObject()) { |  2977   if (obj->IsJSObject() && other->IsJSObject()) { | 
|  2979     return *obj == *other; |  2978     return *obj == *other; | 
|  2980   } |  2979   } | 
|  2981   i::Handle<i::Object> args[] = { other }; |  2980   i::Handle<i::Object> args[] = { other }; | 
|  2982   EXCEPTION_PREAMBLE(isolate); |  2981   EXCEPTION_PREAMBLE(isolate); | 
|  2983   i::Handle<i::Object> result = |  2982   i::Handle<i::Object> result; | 
|  2984       CallV8HeapFunction("EQUALS", obj, ARRAY_SIZE(args), args, |  2983   has_pending_exception = !CallV8HeapFunction( | 
|  2985                          &has_pending_exception); |  2984       "EQUALS", obj, ARRAY_SIZE(args), args).ToHandle(&result); | 
|  2986   EXCEPTION_BAILOUT_CHECK(isolate, false); |  2985   EXCEPTION_BAILOUT_CHECK(isolate, false); | 
|  2987   return *result == i::Smi::FromInt(i::EQUAL); |  2986   return *result == i::Smi::FromInt(i::EQUAL); | 
|  2988 } |  2987 } | 
|  2989  |  2988  | 
|  2990  |  2989  | 
|  2991 bool Value::StrictEquals(Handle<Value> that) const { |  2990 bool Value::StrictEquals(Handle<Value> that) const { | 
|  2992   i::Isolate* isolate = i::Isolate::Current(); |  2991   i::Isolate* isolate = i::Isolate::Current(); | 
|  2993   if (!Utils::ApiCheck(this != NULL && !that.IsEmpty(), |  2992   if (!Utils::ApiCheck(this != NULL && !that.IsEmpty(), | 
|  2994                        "v8::Value::StrictEquals()", |  2993                        "v8::Value::StrictEquals()", | 
|  2995                        "Reading from empty handle")) { |  2994                        "Reading from empty handle")) { | 
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3036  |  3035  | 
|  3037 uint32_t Value::Uint32Value() const { |  3036 uint32_t Value::Uint32Value() const { | 
|  3038   i::Handle<i::Object> obj = Utils::OpenHandle(this); |  3037   i::Handle<i::Object> obj = Utils::OpenHandle(this); | 
|  3039   if (obj->IsSmi()) { |  3038   if (obj->IsSmi()) { | 
|  3040     return i::Smi::cast(*obj)->value(); |  3039     return i::Smi::cast(*obj)->value(); | 
|  3041   } else { |  3040   } else { | 
|  3042     i::Isolate* isolate = i::Isolate::Current(); |  3041     i::Isolate* isolate = i::Isolate::Current(); | 
|  3043     LOG_API(isolate, "Uint32Value"); |  3042     LOG_API(isolate, "Uint32Value"); | 
|  3044     ENTER_V8(isolate); |  3043     ENTER_V8(isolate); | 
|  3045     EXCEPTION_PREAMBLE(isolate); |  3044     EXCEPTION_PREAMBLE(isolate); | 
|  3046     i::Handle<i::Object> num = |  3045     i::Handle<i::Object> num; | 
|  3047         i::Execution::ToUint32(isolate, obj, &has_pending_exception); |  3046     has_pending_exception = !i::Execution::ToUint32( | 
 |  3047         isolate, obj).ToHandle(&num); | 
|  3048     EXCEPTION_BAILOUT_CHECK(isolate, 0); |  3048     EXCEPTION_BAILOUT_CHECK(isolate, 0); | 
|  3049     if (num->IsSmi()) { |  3049     if (num->IsSmi()) { | 
|  3050       return i::Smi::cast(*num)->value(); |  3050       return i::Smi::cast(*num)->value(); | 
|  3051     } else { |  3051     } else { | 
|  3052       return static_cast<uint32_t>(num->Number()); |  3052       return static_cast<uint32_t>(num->Number()); | 
|  3053     } |  3053     } | 
|  3054   } |  3054   } | 
|  3055 } |  3055 } | 
|  3056  |  3056  | 
|  3057  |  3057  | 
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3181 PropertyAttribute v8::Object::GetPropertyAttributes(v8::Handle<Value> key) { |  3181 PropertyAttribute v8::Object::GetPropertyAttributes(v8::Handle<Value> key) { | 
|  3182   i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |  3182   i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 
|  3183   ON_BAILOUT(isolate, "v8::Object::GetPropertyAttribute()", |  3183   ON_BAILOUT(isolate, "v8::Object::GetPropertyAttribute()", | 
|  3184              return static_cast<PropertyAttribute>(NONE)); |  3184              return static_cast<PropertyAttribute>(NONE)); | 
|  3185   ENTER_V8(isolate); |  3185   ENTER_V8(isolate); | 
|  3186   i::HandleScope scope(isolate); |  3186   i::HandleScope scope(isolate); | 
|  3187   i::Handle<i::JSObject> self = Utils::OpenHandle(this); |  3187   i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 
|  3188   i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); |  3188   i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); | 
|  3189   if (!key_obj->IsName()) { |  3189   if (!key_obj->IsName()) { | 
|  3190     EXCEPTION_PREAMBLE(isolate); |  3190     EXCEPTION_PREAMBLE(isolate); | 
|  3191     key_obj = i::Execution::ToString(isolate, key_obj, &has_pending_exception); |  3191     has_pending_exception = !i::Execution::ToString( | 
 |  3192         isolate, key_obj).ToHandle(&key_obj); | 
|  3192     EXCEPTION_BAILOUT_CHECK(isolate, static_cast<PropertyAttribute>(NONE)); |  3193     EXCEPTION_BAILOUT_CHECK(isolate, static_cast<PropertyAttribute>(NONE)); | 
|  3193   } |  3194   } | 
|  3194   i::Handle<i::Name> key_name = i::Handle<i::Name>::cast(key_obj); |  3195   i::Handle<i::Name> key_name = i::Handle<i::Name>::cast(key_obj); | 
|  3195   PropertyAttributes result = |  3196   PropertyAttributes result = | 
|  3196       i::JSReceiver::GetPropertyAttribute(self, key_name); |  3197       i::JSReceiver::GetPropertyAttribute(self, key_name); | 
|  3197   if (result == ABSENT) return static_cast<PropertyAttribute>(NONE); |  3198   if (result == ABSENT) return static_cast<PropertyAttribute>(NONE); | 
|  3198   return static_cast<PropertyAttribute>(result); |  3199   return static_cast<PropertyAttribute>(result); | 
|  3199 } |  3200 } | 
|  3200  |  3201  | 
|  3201  |  3202  | 
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3911   i::HandleScope scope(isolate); |  3912   i::HandleScope scope(isolate); | 
|  3912   i::Handle<i::JSObject> obj = Utils::OpenHandle(this); |  3913   i::Handle<i::JSObject> obj = Utils::OpenHandle(this); | 
|  3913   i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv); |  3914   i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv); | 
|  3914   STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**)); |  3915   STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**)); | 
|  3915   i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv); |  3916   i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv); | 
|  3916   i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>(); |  3917   i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>(); | 
|  3917   if (obj->IsJSFunction()) { |  3918   if (obj->IsJSFunction()) { | 
|  3918     fun = i::Handle<i::JSFunction>::cast(obj); |  3919     fun = i::Handle<i::JSFunction>::cast(obj); | 
|  3919   } else { |  3920   } else { | 
|  3920     EXCEPTION_PREAMBLE(isolate); |  3921     EXCEPTION_PREAMBLE(isolate); | 
|  3921     i::Handle<i::Object> delegate = i::Execution::TryGetFunctionDelegate( |  3922     i::Handle<i::Object> delegate; | 
|  3922         isolate, obj, &has_pending_exception); |  3923     has_pending_exception = !i::Execution::TryGetFunctionDelegate( | 
 |  3924         isolate, obj).ToHandle(&delegate); | 
|  3923     EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); |  3925     EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); | 
|  3924     fun = i::Handle<i::JSFunction>::cast(delegate); |  3926     fun = i::Handle<i::JSFunction>::cast(delegate); | 
|  3925     recv_obj = obj; |  3927     recv_obj = obj; | 
|  3926   } |  3928   } | 
|  3927   EXCEPTION_PREAMBLE(isolate); |  3929   EXCEPTION_PREAMBLE(isolate); | 
|  3928   i::Handle<i::Object> returned = i::Execution::Call( |  3930   i::Handle<i::Object> returned; | 
|  3929       isolate, fun, recv_obj, argc, args, &has_pending_exception, true); |  3931   has_pending_exception = !i::Execution::Call( | 
 |  3932       isolate, fun, recv_obj, argc, args, true).ToHandle(&returned); | 
|  3930   EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<Value>()); |  3933   EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<Value>()); | 
|  3931   return Utils::ToLocal(scope.CloseAndEscape(returned)); |  3934   return Utils::ToLocal(scope.CloseAndEscape(returned)); | 
|  3932 } |  3935 } | 
|  3933  |  3936  | 
|  3934  |  3937  | 
|  3935 Local<v8::Value> Object::CallAsConstructor(int argc, |  3938 Local<v8::Value> Object::CallAsConstructor(int argc, | 
|  3936                                            v8::Handle<v8::Value> argv[]) { |  3939                                            v8::Handle<v8::Value> argv[]) { | 
|  3937   i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |  3940   i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 
|  3938   ON_BAILOUT(isolate, "v8::Object::CallAsConstructor()", |  3941   ON_BAILOUT(isolate, "v8::Object::CallAsConstructor()", | 
|  3939              return Local<v8::Object>()); |  3942              return Local<v8::Object>()); | 
|  3940   LOG_API(isolate, "Object::CallAsConstructor"); |  3943   LOG_API(isolate, "Object::CallAsConstructor"); | 
|  3941   ENTER_V8(isolate); |  3944   ENTER_V8(isolate); | 
|  3942   i::Logger::TimerEventScope timer_scope( |  3945   i::Logger::TimerEventScope timer_scope( | 
|  3943       isolate, i::Logger::TimerEventScope::v8_execute); |  3946       isolate, i::Logger::TimerEventScope::v8_execute); | 
|  3944   i::HandleScope scope(isolate); |  3947   i::HandleScope scope(isolate); | 
|  3945   i::Handle<i::JSObject> obj = Utils::OpenHandle(this); |  3948   i::Handle<i::JSObject> obj = Utils::OpenHandle(this); | 
|  3946   STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**)); |  3949   STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**)); | 
|  3947   i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv); |  3950   i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv); | 
|  3948   if (obj->IsJSFunction()) { |  3951   if (obj->IsJSFunction()) { | 
|  3949     i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(obj); |  3952     i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(obj); | 
|  3950     EXCEPTION_PREAMBLE(isolate); |  3953     EXCEPTION_PREAMBLE(isolate); | 
|  3951     i::Handle<i::Object> returned = |  3954     i::Handle<i::Object> returned; | 
|  3952         i::Execution::New(fun, argc, args, &has_pending_exception); |  3955     has_pending_exception = !i::Execution::New( | 
 |  3956         fun, argc, args).ToHandle(&returned); | 
|  3953     EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<v8::Object>()); |  3957     EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<v8::Object>()); | 
|  3954     return Utils::ToLocal(scope.CloseAndEscape( |  3958     return Utils::ToLocal(scope.CloseAndEscape( | 
|  3955         i::Handle<i::JSObject>::cast(returned))); |  3959         i::Handle<i::JSObject>::cast(returned))); | 
|  3956   } |  3960   } | 
|  3957   EXCEPTION_PREAMBLE(isolate); |  3961   EXCEPTION_PREAMBLE(isolate); | 
|  3958   i::Handle<i::Object> delegate = i::Execution::TryGetConstructorDelegate( |  3962   i::Handle<i::Object> delegate; | 
|  3959       isolate, obj, &has_pending_exception); |  3963   has_pending_exception = !i::Execution::TryGetConstructorDelegate( | 
 |  3964       isolate, obj).ToHandle(&delegate); | 
|  3960   EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Object>()); |  3965   EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Object>()); | 
|  3961   if (!delegate->IsUndefined()) { |  3966   if (!delegate->IsUndefined()) { | 
|  3962     i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(delegate); |  3967     i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(delegate); | 
|  3963     EXCEPTION_PREAMBLE(isolate); |  3968     EXCEPTION_PREAMBLE(isolate); | 
|  3964     i::Handle<i::Object> returned = i::Execution::Call( |  3969     i::Handle<i::Object> returned; | 
|  3965         isolate, fun, obj, argc, args, &has_pending_exception); |  3970     has_pending_exception = !i::Execution::Call( | 
 |  3971         isolate, fun, obj, argc, args).ToHandle(&returned); | 
|  3966     EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<v8::Object>()); |  3972     EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<v8::Object>()); | 
|  3967     ASSERT(!delegate->IsUndefined()); |  3973     ASSERT(!delegate->IsUndefined()); | 
|  3968     return Utils::ToLocal(scope.CloseAndEscape(returned)); |  3974     return Utils::ToLocal(scope.CloseAndEscape(returned)); | 
|  3969   } |  3975   } | 
|  3970   return Local<v8::Object>(); |  3976   return Local<v8::Object>(); | 
|  3971 } |  3977 } | 
|  3972  |  3978  | 
|  3973  |  3979  | 
|  3974 Local<Function> Function::New(Isolate* v8_isolate, |  3980 Local<Function> Function::New(Isolate* v8_isolate, | 
|  3975                               FunctionCallback callback, |  3981                               FunctionCallback callback, | 
| (...skipping 20 matching lines...) Expand all  Loading... | 
|  3996              return Local<v8::Object>()); |  4002              return Local<v8::Object>()); | 
|  3997   LOG_API(isolate, "Function::NewInstance"); |  4003   LOG_API(isolate, "Function::NewInstance"); | 
|  3998   ENTER_V8(isolate); |  4004   ENTER_V8(isolate); | 
|  3999   i::Logger::TimerEventScope timer_scope( |  4005   i::Logger::TimerEventScope timer_scope( | 
|  4000       isolate, i::Logger::TimerEventScope::v8_execute); |  4006       isolate, i::Logger::TimerEventScope::v8_execute); | 
|  4001   EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate)); |  4007   EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate)); | 
|  4002   i::Handle<i::JSFunction> function = Utils::OpenHandle(this); |  4008   i::Handle<i::JSFunction> function = Utils::OpenHandle(this); | 
|  4003   STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**)); |  4009   STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**)); | 
|  4004   i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv); |  4010   i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv); | 
|  4005   EXCEPTION_PREAMBLE(isolate); |  4011   EXCEPTION_PREAMBLE(isolate); | 
|  4006   i::Handle<i::Object> returned = |  4012   i::Handle<i::Object> returned; | 
|  4007       i::Execution::New(function, argc, args, &has_pending_exception); |  4013   has_pending_exception = !i::Execution::New( | 
 |  4014       function, argc, args).ToHandle(&returned); | 
|  4008   EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<v8::Object>()); |  4015   EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<v8::Object>()); | 
|  4009   return scope.Escape(Utils::ToLocal(i::Handle<i::JSObject>::cast(returned))); |  4016   return scope.Escape(Utils::ToLocal(i::Handle<i::JSObject>::cast(returned))); | 
|  4010 } |  4017 } | 
|  4011  |  4018  | 
|  4012  |  4019  | 
|  4013 Local<v8::Value> Function::Call(v8::Handle<v8::Value> recv, int argc, |  4020 Local<v8::Value> Function::Call(v8::Handle<v8::Value> recv, int argc, | 
|  4014                                 v8::Handle<v8::Value> argv[]) { |  4021                                 v8::Handle<v8::Value> argv[]) { | 
|  4015   i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |  4022   i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 
|  4016   ON_BAILOUT(isolate, "v8::Function::Call()", return Local<v8::Value>()); |  4023   ON_BAILOUT(isolate, "v8::Function::Call()", return Local<v8::Value>()); | 
|  4017   LOG_API(isolate, "Function::Call"); |  4024   LOG_API(isolate, "Function::Call"); | 
|  4018   ENTER_V8(isolate); |  4025   ENTER_V8(isolate); | 
|  4019   i::Logger::TimerEventScope timer_scope( |  4026   i::Logger::TimerEventScope timer_scope( | 
|  4020       isolate, i::Logger::TimerEventScope::v8_execute); |  4027       isolate, i::Logger::TimerEventScope::v8_execute); | 
|  4021   i::Object* raw_result = NULL; |  4028   i::HandleScope scope(isolate); | 
|  4022   { |  4029   i::Handle<i::JSFunction> fun = Utils::OpenHandle(this); | 
|  4023     i::HandleScope scope(isolate); |  4030   i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv); | 
|  4024     i::Handle<i::JSFunction> fun = Utils::OpenHandle(this); |  4031   STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**)); | 
|  4025     i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv); |  4032   i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv); | 
|  4026     STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**)); |  4033   EXCEPTION_PREAMBLE(isolate); | 
|  4027     i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv); |  4034   i::Handle<i::Object> returned; | 
|  4028     EXCEPTION_PREAMBLE(isolate); |  4035   has_pending_exception = !i::Execution::Call( | 
|  4029     i::Handle<i::Object> returned = i::Execution::Call( |  4036       isolate, fun, recv_obj, argc, args, true).ToHandle(&returned); | 
|  4030         isolate, fun, recv_obj, argc, args, &has_pending_exception, true); |  4037   EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<Object>()); | 
|  4031     EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<Object>()); |  4038   return Utils::ToLocal(scope.CloseAndEscape(returned)); | 
|  4032     raw_result = *returned; |  | 
|  4033   } |  | 
|  4034   i::Handle<i::Object> result(raw_result, isolate); |  | 
|  4035   return Utils::ToLocal(result); |  | 
|  4036 } |  4039 } | 
|  4037  |  4040  | 
|  4038  |  4041  | 
|  4039 void Function::SetName(v8::Handle<v8::String> name) { |  4042 void Function::SetName(v8::Handle<v8::String> name) { | 
|  4040   i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |  4043   i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 
|  4041   ENTER_V8(isolate); |  4044   ENTER_V8(isolate); | 
|  4042   USE(isolate); |  4045   USE(isolate); | 
|  4043   i::Handle<i::JSFunction> func = Utils::OpenHandle(this); |  4046   i::Handle<i::JSFunction> func = Utils::OpenHandle(this); | 
|  4044   func->shared()->set_name(*Utils::OpenHandle(*name)); |  4047   func->shared()->set_name(*Utils::OpenHandle(*name)); | 
|  4045 } |  4048 } | 
| (...skipping 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  5298 } |  5301 } | 
|  5299  |  5302  | 
|  5300  |  5303  | 
|  5301 Local<v8::Object> ObjectTemplate::NewInstance() { |  5304 Local<v8::Object> ObjectTemplate::NewInstance() { | 
|  5302   i::Isolate* isolate = i::Isolate::Current(); |  5305   i::Isolate* isolate = i::Isolate::Current(); | 
|  5303   ON_BAILOUT(isolate, "v8::ObjectTemplate::NewInstance()", |  5306   ON_BAILOUT(isolate, "v8::ObjectTemplate::NewInstance()", | 
|  5304              return Local<v8::Object>()); |  5307              return Local<v8::Object>()); | 
|  5305   LOG_API(isolate, "ObjectTemplate::NewInstance"); |  5308   LOG_API(isolate, "ObjectTemplate::NewInstance"); | 
|  5306   ENTER_V8(isolate); |  5309   ENTER_V8(isolate); | 
|  5307   EXCEPTION_PREAMBLE(isolate); |  5310   EXCEPTION_PREAMBLE(isolate); | 
|  5308   i::Handle<i::Object> obj = |  5311   i::Handle<i::Object> obj; | 
|  5309       i::Execution::InstantiateObject(Utils::OpenHandle(this), |  5312   has_pending_exception = !i::Execution::InstantiateObject( | 
|  5310                                       &has_pending_exception); |  5313       Utils::OpenHandle(this)).ToHandle(&obj); | 
|  5311   EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Object>()); |  5314   EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Object>()); | 
|  5312   return Utils::ToLocal(i::Handle<i::JSObject>::cast(obj)); |  5315   return Utils::ToLocal(i::Handle<i::JSObject>::cast(obj)); | 
|  5313 } |  5316 } | 
|  5314  |  5317  | 
|  5315  |  5318  | 
|  5316 Local<v8::Function> FunctionTemplate::GetFunction() { |  5319 Local<v8::Function> FunctionTemplate::GetFunction() { | 
|  5317   i::Isolate* isolate = i::Isolate::Current(); |  5320   i::Isolate* isolate = i::Isolate::Current(); | 
|  5318   ON_BAILOUT(isolate, "v8::FunctionTemplate::GetFunction()", |  5321   ON_BAILOUT(isolate, "v8::FunctionTemplate::GetFunction()", | 
|  5319              return Local<v8::Function>()); |  5322              return Local<v8::Function>()); | 
|  5320   LOG_API(isolate, "FunctionTemplate::GetFunction"); |  5323   LOG_API(isolate, "FunctionTemplate::GetFunction"); | 
|  5321   ENTER_V8(isolate); |  5324   ENTER_V8(isolate); | 
|  5322   EXCEPTION_PREAMBLE(isolate); |  5325   EXCEPTION_PREAMBLE(isolate); | 
|  5323   i::Handle<i::Object> obj = |  5326   i::Handle<i::Object> obj; | 
|  5324       i::Execution::InstantiateFunction(Utils::OpenHandle(this), |  5327   has_pending_exception = !i::Execution::InstantiateFunction( | 
|  5325                                         &has_pending_exception); |  5328       Utils::OpenHandle(this)).ToHandle(&obj); | 
|  5326   EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Function>()); |  5329   EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Function>()); | 
|  5327   return Utils::ToLocal(i::Handle<i::JSFunction>::cast(obj)); |  5330   return Utils::ToLocal(i::Handle<i::JSFunction>::cast(obj)); | 
|  5328 } |  5331 } | 
|  5329  |  5332  | 
|  5330  |  5333  | 
|  5331 bool FunctionTemplate::HasInstance(v8::Handle<v8::Value> value) { |  5334 bool FunctionTemplate::HasInstance(v8::Handle<v8::Value> value) { | 
|  5332   ON_BAILOUT(i::Isolate::Current(), "v8::FunctionTemplate::HasInstanceOf()", |  5335   ON_BAILOUT(i::Isolate::Current(), "v8::FunctionTemplate::HasInstanceOf()", | 
|  5333              return false); |  5336              return false); | 
|  5334   i::Object* obj = *Utils::OpenHandle(*value); |  5337   i::Object* obj = *Utils::OpenHandle(*value); | 
|  5335   return Utils::OpenHandle(this)->IsTemplateFor(obj); |  5338   return Utils::OpenHandle(this)->IsTemplateFor(obj); | 
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  5697 Local<v8::Value> v8::Date::New(Isolate* isolate, double time) { |  5700 Local<v8::Value> v8::Date::New(Isolate* isolate, double time) { | 
|  5698   i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |  5701   i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 
|  5699   EnsureInitializedForIsolate(i_isolate, "v8::Date::New()"); |  5702   EnsureInitializedForIsolate(i_isolate, "v8::Date::New()"); | 
|  5700   LOG_API(i_isolate, "Date::New"); |  5703   LOG_API(i_isolate, "Date::New"); | 
|  5701   if (std::isnan(time)) { |  5704   if (std::isnan(time)) { | 
|  5702     // Introduce only canonical NaN value into the VM, to avoid signaling NaNs. |  5705     // Introduce only canonical NaN value into the VM, to avoid signaling NaNs. | 
|  5703     time = i::OS::nan_value(); |  5706     time = i::OS::nan_value(); | 
|  5704   } |  5707   } | 
|  5705   ENTER_V8(i_isolate); |  5708   ENTER_V8(i_isolate); | 
|  5706   EXCEPTION_PREAMBLE(i_isolate); |  5709   EXCEPTION_PREAMBLE(i_isolate); | 
|  5707   i::Handle<i::Object> obj = |  5710   i::Handle<i::Object> obj; | 
|  5708       i::Execution::NewDate(i_isolate, time, &has_pending_exception); |  5711   has_pending_exception = !i::Execution::NewDate( | 
 |  5712       i_isolate, time).ToHandle(&obj); | 
|  5709   EXCEPTION_BAILOUT_CHECK(i_isolate, Local<v8::Value>()); |  5713   EXCEPTION_BAILOUT_CHECK(i_isolate, Local<v8::Value>()); | 
|  5710   return Utils::ToLocal(obj); |  5714   return Utils::ToLocal(obj); | 
|  5711 } |  5715 } | 
|  5712  |  5716  | 
|  5713  |  5717  | 
|  5714 double v8::Date::ValueOf() const { |  5718 double v8::Date::ValueOf() const { | 
|  5715   i::Isolate* isolate = i::Isolate::Current(); |  5719   i::Isolate* isolate = i::Isolate::Current(); | 
|  5716   LOG_API(isolate, "Date::NumberValue"); |  5720   LOG_API(isolate, "Date::NumberValue"); | 
|  5717   i::Handle<i::Object> obj = Utils::OpenHandle(this); |  5721   i::Handle<i::Object> obj = Utils::OpenHandle(this); | 
|  5718   i::Handle<i::JSDate> jsdate = i::Handle<i::JSDate>::cast(obj); |  5722   i::Handle<i::JSDate> jsdate = i::Handle<i::JSDate>::cast(obj); | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  5758 } |  5762 } | 
|  5759  |  5763  | 
|  5760  |  5764  | 
|  5761 Local<v8::RegExp> v8::RegExp::New(Handle<String> pattern, |  5765 Local<v8::RegExp> v8::RegExp::New(Handle<String> pattern, | 
|  5762                                   Flags flags) { |  5766                                   Flags flags) { | 
|  5763   i::Isolate* isolate = Utils::OpenHandle(*pattern)->GetIsolate(); |  5767   i::Isolate* isolate = Utils::OpenHandle(*pattern)->GetIsolate(); | 
|  5764   EnsureInitializedForIsolate(isolate, "v8::RegExp::New()"); |  5768   EnsureInitializedForIsolate(isolate, "v8::RegExp::New()"); | 
|  5765   LOG_API(isolate, "RegExp::New"); |  5769   LOG_API(isolate, "RegExp::New"); | 
|  5766   ENTER_V8(isolate); |  5770   ENTER_V8(isolate); | 
|  5767   EXCEPTION_PREAMBLE(isolate); |  5771   EXCEPTION_PREAMBLE(isolate); | 
|  5768   i::Handle<i::JSRegExp> obj = i::Execution::NewJSRegExp( |  5772   i::Handle<i::JSRegExp> obj; | 
 |  5773   has_pending_exception = !i::Execution::NewJSRegExp( | 
|  5769       Utils::OpenHandle(*pattern), |  5774       Utils::OpenHandle(*pattern), | 
|  5770       RegExpFlagsToString(flags), |  5775       RegExpFlagsToString(flags)).ToHandle(&obj); | 
|  5771       &has_pending_exception); |  | 
|  5772   EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::RegExp>()); |  5776   EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::RegExp>()); | 
|  5773   return Utils::ToLocal(i::Handle<i::JSRegExp>::cast(obj)); |  5777   return Utils::ToLocal(i::Handle<i::JSRegExp>::cast(obj)); | 
|  5774 } |  5778 } | 
|  5775  |  5779  | 
|  5776  |  5780  | 
|  5777 Local<v8::String> v8::RegExp::GetSource() const { |  5781 Local<v8::String> v8::RegExp::GetSource() const { | 
|  5778   i::Handle<i::JSRegExp> obj = Utils::OpenHandle(this); |  5782   i::Handle<i::JSRegExp> obj = Utils::OpenHandle(this); | 
|  5779   return Utils::ToLocal(i::Handle<i::String>(obj->Pattern())); |  5783   return Utils::ToLocal(i::Handle<i::String>(obj->Pattern())); | 
|  5780 } |  5784 } | 
|  5781  |  5785  | 
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  5845  |  5849  | 
|  5846 bool Value::IsPromise() const { |  5850 bool Value::IsPromise() const { | 
|  5847   i::Handle<i::Object> val = Utils::OpenHandle(this); |  5851   i::Handle<i::Object> val = Utils::OpenHandle(this); | 
|  5848   if (!i::FLAG_harmony_promises || !val->IsJSObject()) return false; |  5852   if (!i::FLAG_harmony_promises || !val->IsJSObject()) return false; | 
|  5849   i::Handle<i::JSObject> obj = i::Handle<i::JSObject>::cast(val); |  5853   i::Handle<i::JSObject> obj = i::Handle<i::JSObject>::cast(val); | 
|  5850   i::Isolate* isolate = obj->GetIsolate(); |  5854   i::Isolate* isolate = obj->GetIsolate(); | 
|  5851   LOG_API(isolate, "IsPromise"); |  5855   LOG_API(isolate, "IsPromise"); | 
|  5852   ENTER_V8(isolate); |  5856   ENTER_V8(isolate); | 
|  5853   EXCEPTION_PREAMBLE(isolate); |  5857   EXCEPTION_PREAMBLE(isolate); | 
|  5854   i::Handle<i::Object> argv[] = { obj }; |  5858   i::Handle<i::Object> argv[] = { obj }; | 
|  5855   i::Handle<i::Object> b = i::Execution::Call( |  5859   i::Handle<i::Object> b; | 
 |  5860   has_pending_exception = !i::Execution::Call( | 
|  5856       isolate, |  5861       isolate, | 
|  5857       handle( |  5862       handle( | 
|  5858           isolate->context()->global_object()->native_context()->is_promise()), |  5863           isolate->context()->global_object()->native_context()->is_promise()), | 
|  5859       isolate->factory()->undefined_value(), |  5864       isolate->factory()->undefined_value(), | 
|  5860       ARRAY_SIZE(argv), argv, |  5865       ARRAY_SIZE(argv), argv, | 
|  5861       &has_pending_exception, |  5866       false).ToHandle(&b); | 
|  5862       false); |  | 
|  5863   EXCEPTION_BAILOUT_CHECK(isolate, false); |  5867   EXCEPTION_BAILOUT_CHECK(isolate, false); | 
|  5864   return b->BooleanValue(); |  5868   return b->BooleanValue(); | 
|  5865 } |  5869 } | 
|  5866  |  5870  | 
|  5867  |  5871  | 
|  5868 Local<Promise::Resolver> Promise::Resolver::New(Isolate* v8_isolate) { |  5872 Local<Promise::Resolver> Promise::Resolver::New(Isolate* v8_isolate) { | 
|  5869   i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |  5873   i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); | 
|  5870   LOG_API(isolate, "Promise::Resolver::New"); |  5874   LOG_API(isolate, "Promise::Resolver::New"); | 
|  5871   ENTER_V8(isolate); |  5875   ENTER_V8(isolate); | 
|  5872   EXCEPTION_PREAMBLE(isolate); |  5876   EXCEPTION_PREAMBLE(isolate); | 
|  5873   i::Handle<i::Object> result = i::Execution::Call( |  5877   i::Handle<i::Object> result; | 
 |  5878   has_pending_exception = !i::Execution::Call( | 
|  5874       isolate, |  5879       isolate, | 
|  5875       handle(isolate->context()->global_object()->native_context()-> |  5880       handle(isolate->context()->global_object()->native_context()-> | 
|  5876              promise_create()), |  5881              promise_create()), | 
|  5877       isolate->factory()->undefined_value(), |  5882       isolate->factory()->undefined_value(), | 
|  5878       0, NULL, |  5883       0, NULL, | 
|  5879       &has_pending_exception, |  5884       false).ToHandle(&result); | 
|  5880       false); |  | 
|  5881   EXCEPTION_BAILOUT_CHECK(isolate, Local<Promise::Resolver>()); |  5885   EXCEPTION_BAILOUT_CHECK(isolate, Local<Promise::Resolver>()); | 
|  5882   return Local<Promise::Resolver>::Cast(Utils::ToLocal(result)); |  5886   return Local<Promise::Resolver>::Cast(Utils::ToLocal(result)); | 
|  5883 } |  5887 } | 
|  5884  |  5888  | 
|  5885  |  5889  | 
|  5886 Local<Promise> Promise::Resolver::GetPromise() { |  5890 Local<Promise> Promise::Resolver::GetPromise() { | 
|  5887   i::Handle<i::JSObject> promise = Utils::OpenHandle(this); |  5891   i::Handle<i::JSObject> promise = Utils::OpenHandle(this); | 
|  5888   return Local<Promise>::Cast(Utils::ToLocal(promise)); |  5892   return Local<Promise>::Cast(Utils::ToLocal(promise)); | 
|  5889 } |  5893 } | 
|  5890  |  5894  | 
|  5891  |  5895  | 
|  5892 void Promise::Resolver::Resolve(Handle<Value> value) { |  5896 void Promise::Resolver::Resolve(Handle<Value> value) { | 
|  5893   i::Handle<i::JSObject> promise = Utils::OpenHandle(this); |  5897   i::Handle<i::JSObject> promise = Utils::OpenHandle(this); | 
|  5894   i::Isolate* isolate = promise->GetIsolate(); |  5898   i::Isolate* isolate = promise->GetIsolate(); | 
|  5895   LOG_API(isolate, "Promise::Resolver::Resolve"); |  5899   LOG_API(isolate, "Promise::Resolver::Resolve"); | 
|  5896   ENTER_V8(isolate); |  5900   ENTER_V8(isolate); | 
|  5897   EXCEPTION_PREAMBLE(isolate); |  5901   EXCEPTION_PREAMBLE(isolate); | 
|  5898   i::Handle<i::Object> argv[] = { promise, Utils::OpenHandle(*value) }; |  5902   i::Handle<i::Object> argv[] = { promise, Utils::OpenHandle(*value) }; | 
|  5899   i::Execution::Call( |  5903   has_pending_exception = i::Execution::Call( | 
|  5900       isolate, |  5904       isolate, | 
|  5901       handle(isolate->context()->global_object()->native_context()-> |  5905       handle(isolate->context()->global_object()->native_context()-> | 
|  5902              promise_resolve()), |  5906              promise_resolve()), | 
|  5903       isolate->factory()->undefined_value(), |  5907       isolate->factory()->undefined_value(), | 
|  5904       ARRAY_SIZE(argv), argv, |  5908       ARRAY_SIZE(argv), argv, | 
|  5905       &has_pending_exception, |  5909       false).is_null(); | 
|  5906       false); |  | 
|  5907   EXCEPTION_BAILOUT_CHECK(isolate, /* void */ ;); |  5910   EXCEPTION_BAILOUT_CHECK(isolate, /* void */ ;); | 
|  5908 } |  5911 } | 
|  5909  |  5912  | 
|  5910  |  5913  | 
|  5911 void Promise::Resolver::Reject(Handle<Value> value) { |  5914 void Promise::Resolver::Reject(Handle<Value> value) { | 
|  5912   i::Handle<i::JSObject> promise = Utils::OpenHandle(this); |  5915   i::Handle<i::JSObject> promise = Utils::OpenHandle(this); | 
|  5913   i::Isolate* isolate = promise->GetIsolate(); |  5916   i::Isolate* isolate = promise->GetIsolate(); | 
|  5914   LOG_API(isolate, "Promise::Resolver::Reject"); |  5917   LOG_API(isolate, "Promise::Resolver::Reject"); | 
|  5915   ENTER_V8(isolate); |  5918   ENTER_V8(isolate); | 
|  5916   EXCEPTION_PREAMBLE(isolate); |  5919   EXCEPTION_PREAMBLE(isolate); | 
|  5917   i::Handle<i::Object> argv[] = { promise, Utils::OpenHandle(*value) }; |  5920   i::Handle<i::Object> argv[] = { promise, Utils::OpenHandle(*value) }; | 
|  5918   i::Execution::Call( |  5921   has_pending_exception = i::Execution::Call( | 
|  5919       isolate, |  5922       isolate, | 
|  5920       handle(isolate->context()->global_object()->native_context()-> |  5923       handle(isolate->context()->global_object()->native_context()-> | 
|  5921              promise_reject()), |  5924              promise_reject()), | 
|  5922       isolate->factory()->undefined_value(), |  5925       isolate->factory()->undefined_value(), | 
|  5923       ARRAY_SIZE(argv), argv, |  5926       ARRAY_SIZE(argv), argv, | 
|  5924       &has_pending_exception, |  5927       false).is_null(); | 
|  5925       false); |  | 
|  5926   EXCEPTION_BAILOUT_CHECK(isolate, /* void */ ;); |  5928   EXCEPTION_BAILOUT_CHECK(isolate, /* void */ ;); | 
|  5927 } |  5929 } | 
|  5928  |  5930  | 
|  5929  |  5931  | 
|  5930 Local<Promise> Promise::Chain(Handle<Function> handler) { |  5932 Local<Promise> Promise::Chain(Handle<Function> handler) { | 
|  5931   i::Handle<i::JSObject> promise = Utils::OpenHandle(this); |  5933   i::Handle<i::JSObject> promise = Utils::OpenHandle(this); | 
|  5932   i::Isolate* isolate = promise->GetIsolate(); |  5934   i::Isolate* isolate = promise->GetIsolate(); | 
|  5933   LOG_API(isolate, "Promise::Chain"); |  5935   LOG_API(isolate, "Promise::Chain"); | 
|  5934   ENTER_V8(isolate); |  5936   ENTER_V8(isolate); | 
|  5935   EXCEPTION_PREAMBLE(isolate); |  5937   EXCEPTION_PREAMBLE(isolate); | 
|  5936   i::Handle<i::Object> argv[] = { Utils::OpenHandle(*handler) }; |  5938   i::Handle<i::Object> argv[] = { Utils::OpenHandle(*handler) }; | 
|  5937   i::Handle<i::Object> result = i::Execution::Call( |  5939   i::Handle<i::Object> result; | 
 |  5940   has_pending_exception = !i::Execution::Call( | 
|  5938       isolate, |  5941       isolate, | 
|  5939       handle(isolate->context()->global_object()->native_context()-> |  5942       handle(isolate->context()->global_object()->native_context()-> | 
|  5940              promise_chain()), |  5943              promise_chain()), | 
|  5941       promise, |  5944       promise, | 
|  5942       ARRAY_SIZE(argv), argv, |  5945       ARRAY_SIZE(argv), argv, | 
|  5943       &has_pending_exception, |  5946       false).ToHandle(&result); | 
|  5944       false); |  | 
|  5945   EXCEPTION_BAILOUT_CHECK(isolate, Local<Promise>()); |  5947   EXCEPTION_BAILOUT_CHECK(isolate, Local<Promise>()); | 
|  5946   return Local<Promise>::Cast(Utils::ToLocal(result)); |  5948   return Local<Promise>::Cast(Utils::ToLocal(result)); | 
|  5947 } |  5949 } | 
|  5948  |  5950  | 
|  5949  |  5951  | 
|  5950 Local<Promise> Promise::Catch(Handle<Function> handler) { |  5952 Local<Promise> Promise::Catch(Handle<Function> handler) { | 
|  5951   i::Handle<i::JSObject> promise = Utils::OpenHandle(this); |  5953   i::Handle<i::JSObject> promise = Utils::OpenHandle(this); | 
|  5952   i::Isolate* isolate = promise->GetIsolate(); |  5954   i::Isolate* isolate = promise->GetIsolate(); | 
|  5953   LOG_API(isolate, "Promise::Catch"); |  5955   LOG_API(isolate, "Promise::Catch"); | 
|  5954   ENTER_V8(isolate); |  5956   ENTER_V8(isolate); | 
|  5955   EXCEPTION_PREAMBLE(isolate); |  5957   EXCEPTION_PREAMBLE(isolate); | 
|  5956   i::Handle<i::Object> argv[] = { Utils::OpenHandle(*handler) }; |  5958   i::Handle<i::Object> argv[] = { Utils::OpenHandle(*handler) }; | 
|  5957   i::Handle<i::Object> result = i::Execution::Call( |  5959   i::Handle<i::Object> result; | 
 |  5960   has_pending_exception = !i::Execution::Call( | 
|  5958       isolate, |  5961       isolate, | 
|  5959       handle(isolate->context()->global_object()->native_context()-> |  5962       handle(isolate->context()->global_object()->native_context()-> | 
|  5960              promise_catch()), |  5963              promise_catch()), | 
|  5961       promise, |  5964       promise, | 
|  5962       ARRAY_SIZE(argv), argv, |  5965       ARRAY_SIZE(argv), argv, | 
|  5963       &has_pending_exception, |  5966       false).ToHandle(&result); | 
|  5964       false); |  | 
|  5965   EXCEPTION_BAILOUT_CHECK(isolate, Local<Promise>()); |  5967   EXCEPTION_BAILOUT_CHECK(isolate, Local<Promise>()); | 
|  5966   return Local<Promise>::Cast(Utils::ToLocal(result)); |  5968   return Local<Promise>::Cast(Utils::ToLocal(result)); | 
|  5967 } |  5969 } | 
|  5968  |  5970  | 
|  5969  |  5971  | 
|  5970 bool v8::ArrayBuffer::IsExternal() const { |  5972 bool v8::ArrayBuffer::IsExternal() const { | 
|  5971   return Utils::OpenHandle(this)->is_external(); |  5973   return Utils::OpenHandle(this)->is_external(); | 
|  5972 } |  5974 } | 
|  5973  |  5975  | 
|  5974  |  5976  | 
| (...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  6963       handler, provide_locker); |  6965       handler, provide_locker); | 
|  6964 } |  6966 } | 
|  6965  |  6967  | 
|  6966  |  6968  | 
|  6967 Local<Value> Debug::Call(v8::Handle<v8::Function> fun, |  6969 Local<Value> Debug::Call(v8::Handle<v8::Function> fun, | 
|  6968                          v8::Handle<v8::Value> data) { |  6970                          v8::Handle<v8::Value> data) { | 
|  6969   i::Isolate* isolate = i::Isolate::Current(); |  6971   i::Isolate* isolate = i::Isolate::Current(); | 
|  6970   if (!isolate->IsInitialized()) return Local<Value>(); |  6972   if (!isolate->IsInitialized()) return Local<Value>(); | 
|  6971   ON_BAILOUT(isolate, "v8::Debug::Call()", return Local<Value>()); |  6973   ON_BAILOUT(isolate, "v8::Debug::Call()", return Local<Value>()); | 
|  6972   ENTER_V8(isolate); |  6974   ENTER_V8(isolate); | 
|  6973   i::Handle<i::Object> result; |  6975   i::MaybeHandle<i::Object> maybe_result; | 
|  6974   EXCEPTION_PREAMBLE(isolate); |  6976   EXCEPTION_PREAMBLE(isolate); | 
|  6975   if (data.IsEmpty()) { |  6977   if (data.IsEmpty()) { | 
|  6976     result = isolate->debugger()->Call(Utils::OpenHandle(*fun), |  6978     maybe_result = isolate->debugger()->Call( | 
|  6977                                        isolate->factory()->undefined_value(), |  6979         Utils::OpenHandle(*fun), isolate->factory()->undefined_value()); | 
|  6978                                        &has_pending_exception); |  | 
|  6979   } else { |  6980   } else { | 
|  6980     result = isolate->debugger()->Call(Utils::OpenHandle(*fun), |  6981     maybe_result = isolate->debugger()->Call( | 
|  6981                                        Utils::OpenHandle(*data), |  6982         Utils::OpenHandle(*fun), Utils::OpenHandle(*data)); | 
|  6982                                        &has_pending_exception); |  | 
|  6983   } |  6983   } | 
 |  6984   i::Handle<i::Object> result; | 
 |  6985   has_pending_exception = !maybe_result.ToHandle(&result); | 
|  6984   EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); |  6986   EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); | 
|  6985   return Utils::ToLocal(result); |  6987   return Utils::ToLocal(result); | 
|  6986 } |  6988 } | 
|  6987  |  6989  | 
|  6988  |  6990  | 
|  6989 Local<Value> Debug::GetMirror(v8::Handle<v8::Value> obj) { |  6991 Local<Value> Debug::GetMirror(v8::Handle<v8::Value> obj) { | 
|  6990   i::Isolate* isolate = i::Isolate::Current(); |  6992   i::Isolate* isolate = i::Isolate::Current(); | 
|  6991   if (!isolate->IsInitialized()) return Local<Value>(); |  6993   if (!isolate->IsInitialized()) return Local<Value>(); | 
|  6992   ON_BAILOUT(isolate, "v8::Debug::GetMirror()", return Local<Value>()); |  6994   ON_BAILOUT(isolate, "v8::Debug::GetMirror()", return Local<Value>()); | 
|  6993   ENTER_V8(isolate); |  6995   ENTER_V8(isolate); | 
| (...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  7691   Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |  7693   Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 
|  7692   Address callback_address = |  7694   Address callback_address = | 
|  7693       reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |  7695       reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 
|  7694   VMState<EXTERNAL> state(isolate); |  7696   VMState<EXTERNAL> state(isolate); | 
|  7695   ExternalCallbackScope call_scope(isolate, callback_address); |  7697   ExternalCallbackScope call_scope(isolate, callback_address); | 
|  7696   callback(info); |  7698   callback(info); | 
|  7697 } |  7699 } | 
|  7698  |  7700  | 
|  7699  |  7701  | 
|  7700 } }  // namespace v8::internal |  7702 } }  // namespace v8::internal | 
| OLD | NEW |