| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 | 369 |
| 370 | 370 |
| 371 Handle<Object> GetProperty(Handle<Object> obj, | 371 Handle<Object> GetProperty(Handle<Object> obj, |
| 372 Handle<Object> key) { | 372 Handle<Object> key) { |
| 373 Isolate* isolate = Isolate::Current(); | 373 Isolate* isolate = Isolate::Current(); |
| 374 CALL_HEAP_FUNCTION(isolate, | 374 CALL_HEAP_FUNCTION(isolate, |
| 375 Runtime::GetObjectProperty(isolate, obj, key), Object); | 375 Runtime::GetObjectProperty(isolate, obj, key), Object); |
| 376 } | 376 } |
| 377 | 377 |
| 378 | 378 |
| 379 Handle<Object> GetElement(Handle<Object> obj, | |
| 380 uint32_t index) { | |
| 381 Isolate* isolate = Isolate::Current(); | |
| 382 CALL_HEAP_FUNCTION(isolate, Runtime::GetElement(obj, index), Object); | |
| 383 } | |
| 384 | |
| 385 | |
| 386 Handle<Object> GetPropertyWithInterceptor(Handle<JSObject> receiver, | 379 Handle<Object> GetPropertyWithInterceptor(Handle<JSObject> receiver, |
| 387 Handle<JSObject> holder, | 380 Handle<JSObject> holder, |
| 388 Handle<String> name, | 381 Handle<String> name, |
| 389 PropertyAttributes* attributes) { | 382 PropertyAttributes* attributes) { |
| 390 Isolate* isolate = receiver->GetIsolate(); | 383 Isolate* isolate = receiver->GetIsolate(); |
| 391 CALL_HEAP_FUNCTION(isolate, | 384 CALL_HEAP_FUNCTION(isolate, |
| 392 holder->GetPropertyWithInterceptor(*receiver, | 385 holder->GetPropertyWithInterceptor(*receiver, |
| 393 *name, | 386 *name, |
| 394 attributes), | 387 attributes), |
| 395 Object); | 388 Object); |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 | 874 |
| 882 Handle<ObjectHashTable> PutIntoObjectHashTable(Handle<ObjectHashTable> table, | 875 Handle<ObjectHashTable> PutIntoObjectHashTable(Handle<ObjectHashTable> table, |
| 883 Handle<JSReceiver> key, | 876 Handle<JSReceiver> key, |
| 884 Handle<Object> value) { | 877 Handle<Object> value) { |
| 885 CALL_HEAP_FUNCTION(table->GetIsolate(), | 878 CALL_HEAP_FUNCTION(table->GetIsolate(), |
| 886 table->Put(*key, *value), | 879 table->Put(*key, *value), |
| 887 ObjectHashTable); | 880 ObjectHashTable); |
| 888 } | 881 } |
| 889 | 882 |
| 890 | 883 |
| 891 bool EnsureCompiled(Handle<SharedFunctionInfo> shared, | |
| 892 ClearExceptionFlag flag) { | |
| 893 return shared->is_compiled() || CompileLazyShared(shared, flag); | |
| 894 } | |
| 895 | |
| 896 | |
| 897 static bool CompileLazyHelper(CompilationInfo* info, | |
| 898 ClearExceptionFlag flag) { | |
| 899 // Compile the source information to a code object. | |
| 900 ASSERT(info->IsOptimizing() || !info->shared_info()->is_compiled()); | |
| 901 ASSERT(!info->isolate()->has_pending_exception()); | |
| 902 bool result = Compiler::CompileLazy(info); | |
| 903 ASSERT(result != Isolate::Current()->has_pending_exception()); | |
| 904 if (!result && flag == CLEAR_EXCEPTION) { | |
| 905 info->isolate()->clear_pending_exception(); | |
| 906 } | |
| 907 return result; | |
| 908 } | |
| 909 | |
| 910 | |
| 911 bool CompileLazyShared(Handle<SharedFunctionInfo> shared, | |
| 912 ClearExceptionFlag flag) { | |
| 913 CompilationInfo info(shared); | |
| 914 return CompileLazyHelper(&info, flag); | |
| 915 } | |
| 916 | |
| 917 | |
| 918 bool CompileLazy(Handle<JSFunction> function, ClearExceptionFlag flag) { | |
| 919 bool result = true; | |
| 920 if (function->shared()->is_compiled()) { | |
| 921 function->ReplaceCode(function->shared()->code()); | |
| 922 function->shared()->set_code_age(0); | |
| 923 } else { | |
| 924 CompilationInfo info(function); | |
| 925 result = CompileLazyHelper(&info, flag); | |
| 926 ASSERT(!result || function->is_compiled()); | |
| 927 } | |
| 928 return result; | |
| 929 } | |
| 930 | |
| 931 | |
| 932 bool CompileOptimized(Handle<JSFunction> function, | |
| 933 int osr_ast_id, | |
| 934 ClearExceptionFlag flag) { | |
| 935 CompilationInfo info(function); | |
| 936 info.SetOptimizing(osr_ast_id); | |
| 937 return CompileLazyHelper(&info, flag); | |
| 938 } | |
| 939 | |
| 940 } } // namespace v8::internal | 884 } } // namespace v8::internal |
| OLD | NEW |