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 1441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1452 FunctionTemplate::New(RealmDispose)); | 1452 FunctionTemplate::New(RealmDispose)); |
1453 realm_template->Set(String::New("switch"), | 1453 realm_template->Set(String::New("switch"), |
1454 FunctionTemplate::New(RealmSwitch)); | 1454 FunctionTemplate::New(RealmSwitch)); |
1455 realm_template->Set(String::New("eval"), | 1455 realm_template->Set(String::New("eval"), |
1456 FunctionTemplate::New(RealmEval)); | 1456 FunctionTemplate::New(RealmEval)); |
1457 realm_template->SetAccessor(String::New("shared"), | 1457 realm_template->SetAccessor(String::New("shared"), |
1458 RealmSharedGet, RealmSharedSet); | 1458 RealmSharedGet, RealmSharedSet); |
1459 global_template->Set(String::New("Realm"), realm_template); | 1459 global_template->Set(String::New("Realm"), realm_template); |
1460 | 1460 |
1461 // Bind the handlers for external arrays. | 1461 // Bind the handlers for external arrays. |
| 1462 #ifndef V8_SHARED |
1462 if (!i::FLAG_harmony_typed_arrays) { | 1463 if (!i::FLAG_harmony_typed_arrays) { |
| 1464 #endif // V8_SHARED |
1463 PropertyAttribute attr = | 1465 PropertyAttribute attr = |
1464 static_cast<PropertyAttribute>(ReadOnly | DontDelete); | 1466 static_cast<PropertyAttribute>(ReadOnly | DontDelete); |
1465 global_template->Set(PerIsolateData::ArrayBuffer_string(isolate), | 1467 global_template->Set(PerIsolateData::ArrayBuffer_string(isolate), |
1466 CreateArrayBufferTemplate(ArrayBuffer), attr); | 1468 CreateArrayBufferTemplate(ArrayBuffer), attr); |
1467 global_template->Set(String::New("Int8Array"), | 1469 global_template->Set(String::New("Int8Array"), |
1468 CreateArrayTemplate(Int8Array), attr); | 1470 CreateArrayTemplate(Int8Array), attr); |
1469 global_template->Set(String::New("Uint8Array"), | 1471 global_template->Set(String::New("Uint8Array"), |
1470 CreateArrayTemplate(Uint8Array), attr); | 1472 CreateArrayTemplate(Uint8Array), attr); |
1471 global_template->Set(String::New("Int16Array"), | 1473 global_template->Set(String::New("Int16Array"), |
1472 CreateArrayTemplate(Int16Array), attr); | 1474 CreateArrayTemplate(Int16Array), attr); |
1473 global_template->Set(String::New("Uint16Array"), | 1475 global_template->Set(String::New("Uint16Array"), |
1474 CreateArrayTemplate(Uint16Array), attr); | 1476 CreateArrayTemplate(Uint16Array), attr); |
1475 global_template->Set(String::New("Int32Array"), | 1477 global_template->Set(String::New("Int32Array"), |
1476 CreateArrayTemplate(Int32Array), attr); | 1478 CreateArrayTemplate(Int32Array), attr); |
1477 global_template->Set(String::New("Uint32Array"), | 1479 global_template->Set(String::New("Uint32Array"), |
1478 CreateArrayTemplate(Uint32Array), attr); | 1480 CreateArrayTemplate(Uint32Array), attr); |
1479 global_template->Set(String::New("Float32Array"), | 1481 global_template->Set(String::New("Float32Array"), |
1480 CreateArrayTemplate(Float32Array), attr); | 1482 CreateArrayTemplate(Float32Array), attr); |
1481 global_template->Set(String::New("Float64Array"), | 1483 global_template->Set(String::New("Float64Array"), |
1482 CreateArrayTemplate(Float64Array), attr); | 1484 CreateArrayTemplate(Float64Array), attr); |
1483 global_template->Set(String::New("Uint8ClampedArray"), | 1485 global_template->Set(String::New("Uint8ClampedArray"), |
1484 CreateArrayTemplate(Uint8ClampedArray), attr); | 1486 CreateArrayTemplate(Uint8ClampedArray), attr); |
| 1487 #ifndef V8_SHARED |
1485 } | 1488 } |
| 1489 #endif // V8_SHARED |
1486 | 1490 |
1487 #if !defined(V8_SHARED) && !defined(_WIN32) && !defined(_WIN64) | 1491 #if !defined(V8_SHARED) && !defined(_WIN32) && !defined(_WIN64) |
1488 Handle<ObjectTemplate> os_templ = ObjectTemplate::New(); | 1492 Handle<ObjectTemplate> os_templ = ObjectTemplate::New(); |
1489 AddOSMethods(os_templ); | 1493 AddOSMethods(os_templ); |
1490 global_template->Set(String::New("os"), os_templ); | 1494 global_template->Set(String::New("os"), os_templ); |
1491 #endif // V8_SHARED | 1495 #endif // V8_SHARED |
1492 | 1496 |
1493 return global_template; | 1497 return global_template; |
1494 } | 1498 } |
1495 | 1499 |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1719 | 1723 |
1720 | 1724 |
1721 static char* ReadLine(char* data) { | 1725 static char* ReadLine(char* data) { |
1722 return ReadToken(data, '\n'); | 1726 return ReadToken(data, '\n'); |
1723 } | 1727 } |
1724 | 1728 |
1725 | 1729 |
1726 static char* ReadWord(char* data) { | 1730 static char* ReadWord(char* data) { |
1727 return ReadToken(data, ' '); | 1731 return ReadToken(data, ' '); |
1728 } | 1732 } |
1729 #endif // V8_SHARED | 1733 #endif // trueV8_SHARED |
1730 | 1734 |
1731 | 1735 |
1732 // Reads a file into a v8 string. | 1736 // Reads a file into a v8 string. |
1733 Handle<String> Shell::ReadFile(Isolate* isolate, const char* name) { | 1737 Handle<String> Shell::ReadFile(Isolate* isolate, const char* name) { |
1734 int size = 0; | 1738 int size = 0; |
1735 char* chars = ReadChars(isolate, name, &size); | 1739 char* chars = ReadChars(isolate, name, &size); |
1736 if (chars == NULL) return Handle<String>(); | 1740 if (chars == NULL) return Handle<String>(); |
1737 Handle<String> result = String::New(chars, size); | 1741 Handle<String> result = String::New(chars, size); |
1738 delete[] chars; | 1742 delete[] chars; |
1739 return result; | 1743 return result; |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2219 } | 2223 } |
2220 | 2224 |
2221 } // namespace v8 | 2225 } // namespace v8 |
2222 | 2226 |
2223 | 2227 |
2224 #ifndef GOOGLE3 | 2228 #ifndef GOOGLE3 |
2225 int main(int argc, char* argv[]) { | 2229 int main(int argc, char* argv[]) { |
2226 return v8::Shell::Main(argc, argv); | 2230 return v8::Shell::Main(argc, argv); |
2227 } | 2231 } |
2228 #endif | 2232 #endif |
OLD | NEW |