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 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 | 1098 |
1099 Isolate* isolate = args.GetIsolate(); | 1099 Isolate* isolate = args.GetIsolate(); |
1100 uint8_t* data = reinterpret_cast<uint8_t*>( | 1100 uint8_t* data = reinterpret_cast<uint8_t*>( |
1101 ReadChars(args.GetIsolate(), *filename, &length)); | 1101 ReadChars(args.GetIsolate(), *filename, &length)); |
1102 if (data == NULL) { | 1102 if (data == NULL) { |
1103 Throw("Error reading file"); | 1103 Throw("Error reading file"); |
1104 return; | 1104 return; |
1105 } | 1105 } |
1106 Handle<v8::ArrayBuffer> buffer = ArrayBuffer::New(data, length); | 1106 Handle<v8::ArrayBuffer> buffer = ArrayBuffer::New(data, length); |
1107 v8::Persistent<v8::ArrayBuffer> weak_handle(isolate, buffer); | 1107 v8::Persistent<v8::ArrayBuffer> weak_handle(isolate, buffer); |
1108 weak_handle.MakeWeak(isolate, data, ReadBufferWeakCallback); | 1108 weak_handle.MakeWeak(data, ReadBufferWeakCallback); |
1109 weak_handle.MarkIndependent(); | 1109 weak_handle.MarkIndependent(); |
1110 isolate->AdjustAmountOfExternalAllocatedMemory(length); | 1110 isolate->AdjustAmountOfExternalAllocatedMemory(length); |
1111 | 1111 |
1112 args.GetReturnValue().Set(buffer); | 1112 args.GetReturnValue().Set(buffer); |
1113 } | 1113 } |
1114 | 1114 |
1115 | 1115 |
1116 #ifndef V8_SHARED | 1116 #ifndef V8_SHARED |
1117 static char* ReadToken(char* data, char token) { | 1117 static char* ReadToken(char* data, char token) { |
1118 char* next = i::OS::StrChr(data, token); | 1118 char* next = i::OS::StrChr(data, token); |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1657 } | 1657 } |
1658 | 1658 |
1659 } // namespace v8 | 1659 } // namespace v8 |
1660 | 1660 |
1661 | 1661 |
1662 #ifndef GOOGLE3 | 1662 #ifndef GOOGLE3 |
1663 int main(int argc, char* argv[]) { | 1663 int main(int argc, char* argv[]) { |
1664 return v8::Shell::Main(argc, argv); | 1664 return v8::Shell::Main(argc, argv); |
1665 } | 1665 } |
1666 #endif | 1666 #endif |
OLD | NEW |