| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 context->native_context()); | 960 context->native_context()); |
| 961 } | 961 } |
| 962 result->set_literals(*literals); | 962 result->set_literals(*literals); |
| 963 } | 963 } |
| 964 | 964 |
| 965 if (index > 0) { | 965 if (index > 0) { |
| 966 // Caching of optimized code enabled and optimized code found. | 966 // Caching of optimized code enabled and optimized code found. |
| 967 FixedArray* literals = | 967 FixedArray* literals = |
| 968 function_info->GetLiteralsFromOptimizedCodeMap(index); | 968 function_info->GetLiteralsFromOptimizedCodeMap(index); |
| 969 if (literals != NULL) result->set_literals(literals); | 969 if (literals != NULL) result->set_literals(literals); |
| 970 result->ReplaceCode(function_info->GetCodeFromOptimizedCodeMap(index)); | 970 Code* code = function_info->GetCodeFromOptimizedCodeMap(index); |
| 971 ASSERT(!code->marked_for_deoptimization()); |
| 972 result->ReplaceCode(code); |
| 971 return result; | 973 return result; |
| 972 } | 974 } |
| 973 | 975 |
| 974 if (isolate()->use_crankshaft() && | 976 if (isolate()->use_crankshaft() && |
| 975 FLAG_always_opt && | 977 FLAG_always_opt && |
| 976 result->is_compiled() && | 978 result->is_compiled() && |
| 977 !function_info->is_toplevel() && | 979 !function_info->is_toplevel() && |
| 978 function_info->allows_lazy_compilation() && | 980 function_info->allows_lazy_compilation() && |
| 979 !function_info->optimization_disabled() && | 981 !function_info->optimization_disabled() && |
| 980 !isolate()->DebuggerHasBreakPoints()) { | 982 !isolate()->DebuggerHasBreakPoints()) { |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1293 } | 1295 } |
| 1294 | 1296 |
| 1295 | 1297 |
| 1296 Handle<Code> Factory::CopyCode(Handle<Code> code, Vector<byte> reloc_info) { | 1298 Handle<Code> Factory::CopyCode(Handle<Code> code, Vector<byte> reloc_info) { |
| 1297 CALL_HEAP_FUNCTION(isolate(), | 1299 CALL_HEAP_FUNCTION(isolate(), |
| 1298 isolate()->heap()->CopyCode(*code, reloc_info), | 1300 isolate()->heap()->CopyCode(*code, reloc_info), |
| 1299 Code); | 1301 Code); |
| 1300 } | 1302 } |
| 1301 | 1303 |
| 1302 | 1304 |
| 1303 Handle<String> Factory::InternalizedStringFromString(Handle<String> value) { | |
| 1304 CALL_HEAP_FUNCTION(isolate(), | |
| 1305 isolate()->heap()->InternalizeString(*value), String); | |
| 1306 } | |
| 1307 | |
| 1308 | |
| 1309 Handle<JSObject> Factory::NewJSObject(Handle<JSFunction> constructor, | 1305 Handle<JSObject> Factory::NewJSObject(Handle<JSFunction> constructor, |
| 1310 PretenureFlag pretenure) { | 1306 PretenureFlag pretenure) { |
| 1311 JSFunction::EnsureHasInitialMap(constructor); | 1307 JSFunction::EnsureHasInitialMap(constructor); |
| 1312 CALL_HEAP_FUNCTION( | 1308 CALL_HEAP_FUNCTION( |
| 1313 isolate(), | 1309 isolate(), |
| 1314 isolate()->heap()->AllocateJSObject(*constructor, pretenure), JSObject); | 1310 isolate()->heap()->AllocateJSObject(*constructor, pretenure), JSObject); |
| 1315 } | 1311 } |
| 1316 | 1312 |
| 1317 | 1313 |
| 1318 Handle<JSModule> Factory::NewJSModule(Handle<Context> context, | 1314 Handle<JSModule> Factory::NewJSModule(Handle<Context> context, |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1485 isolate(), | 1481 isolate(), |
| 1486 isolate()->heap()->AllocateJSObject(*data_view_fun), | 1482 isolate()->heap()->AllocateJSObject(*data_view_fun), |
| 1487 JSDataView); | 1483 JSDataView); |
| 1488 } | 1484 } |
| 1489 | 1485 |
| 1490 | 1486 |
| 1491 static JSFunction* GetTypedArrayFun(ExternalArrayType type, | 1487 static JSFunction* GetTypedArrayFun(ExternalArrayType type, |
| 1492 Isolate* isolate) { | 1488 Isolate* isolate) { |
| 1493 Context* native_context = isolate->context()->native_context(); | 1489 Context* native_context = isolate->context()->native_context(); |
| 1494 switch (type) { | 1490 switch (type) { |
| 1495 case kExternalUnsignedByteArray: | 1491 #define TYPED_ARRAY_FUN(Type, type, TYPE, ctype, size) \ |
| 1496 return native_context->uint8_array_fun(); | 1492 case kExternal##Type##Array: \ |
| 1493 return native_context->type##_array_fun(); |
| 1497 | 1494 |
| 1498 case kExternalByteArray: | 1495 TYPED_ARRAYS(TYPED_ARRAY_FUN) |
| 1499 return native_context->int8_array_fun(); | 1496 #undef TYPED_ARRAY_FUN |
| 1500 | |
| 1501 case kExternalUnsignedShortArray: | |
| 1502 return native_context->uint16_array_fun(); | |
| 1503 | |
| 1504 case kExternalShortArray: | |
| 1505 return native_context->int16_array_fun(); | |
| 1506 | |
| 1507 case kExternalUnsignedIntArray: | |
| 1508 return native_context->uint32_array_fun(); | |
| 1509 | |
| 1510 case kExternalIntArray: | |
| 1511 return native_context->int32_array_fun(); | |
| 1512 | |
| 1513 case kExternalFloatArray: | |
| 1514 return native_context->float_array_fun(); | |
| 1515 | |
| 1516 case kExternalDoubleArray: | |
| 1517 return native_context->double_array_fun(); | |
| 1518 | |
| 1519 case kExternalPixelArray: | |
| 1520 return native_context->uint8c_array_fun(); | |
| 1521 | 1497 |
| 1522 default: | 1498 default: |
| 1523 UNREACHABLE(); | 1499 UNREACHABLE(); |
| 1524 return NULL; | 1500 return NULL; |
| 1525 } | 1501 } |
| 1526 } | 1502 } |
| 1527 | 1503 |
| 1528 | 1504 |
| 1529 Handle<JSTypedArray> Factory::NewJSTypedArray(ExternalArrayType type) { | 1505 Handle<JSTypedArray> Factory::NewJSTypedArray(ExternalArrayType type) { |
| 1530 Handle<JSFunction> typed_array_fun_handle(GetTypedArrayFun(type, isolate())); | 1506 Handle<JSFunction> typed_array_fun_handle(GetTypedArrayFun(type, isolate())); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1585 return shared; | 1561 return shared; |
| 1586 } | 1562 } |
| 1587 | 1563 |
| 1588 | 1564 |
| 1589 Handle<JSMessageObject> Factory::NewJSMessageObject( | 1565 Handle<JSMessageObject> Factory::NewJSMessageObject( |
| 1590 Handle<String> type, | 1566 Handle<String> type, |
| 1591 Handle<JSArray> arguments, | 1567 Handle<JSArray> arguments, |
| 1592 int start_position, | 1568 int start_position, |
| 1593 int end_position, | 1569 int end_position, |
| 1594 Handle<Object> script, | 1570 Handle<Object> script, |
| 1595 Handle<Object> stack_trace, | |
| 1596 Handle<Object> stack_frames) { | 1571 Handle<Object> stack_frames) { |
| 1597 CALL_HEAP_FUNCTION(isolate(), | 1572 CALL_HEAP_FUNCTION(isolate(), |
| 1598 isolate()->heap()->AllocateJSMessageObject(*type, | 1573 isolate()->heap()->AllocateJSMessageObject(*type, |
| 1599 *arguments, | 1574 *arguments, |
| 1600 start_position, | 1575 start_position, |
| 1601 end_position, | 1576 end_position, |
| 1602 *script, | 1577 *script, |
| 1603 *stack_trace, | |
| 1604 *stack_frames), | 1578 *stack_frames), |
| 1605 JSMessageObject); | 1579 JSMessageObject); |
| 1606 } | 1580 } |
| 1607 | 1581 |
| 1608 | 1582 |
| 1609 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo(Handle<String> name) { | 1583 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo(Handle<String> name) { |
| 1610 CALL_HEAP_FUNCTION(isolate(), | 1584 CALL_HEAP_FUNCTION(isolate(), |
| 1611 isolate()->heap()->AllocateSharedFunctionInfo(*name), | 1585 isolate()->heap()->AllocateSharedFunctionInfo(*name), |
| 1612 SharedFunctionInfo); | 1586 SharedFunctionInfo); |
| 1613 } | 1587 } |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2016 return Handle<Object>::null(); | 1990 return Handle<Object>::null(); |
| 2017 } | 1991 } |
| 2018 | 1992 |
| 2019 | 1993 |
| 2020 Handle<Object> Factory::ToBoolean(bool value) { | 1994 Handle<Object> Factory::ToBoolean(bool value) { |
| 2021 return value ? true_value() : false_value(); | 1995 return value ? true_value() : false_value(); |
| 2022 } | 1996 } |
| 2023 | 1997 |
| 2024 | 1998 |
| 2025 } } // namespace v8::internal | 1999 } } // namespace v8::internal |
| OLD | NEW |