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 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 for (int i = 0; i < source_length; ++i) | 1055 for (int i = 0; i < source_length; ++i) |
1056 self->Set(offset + i, source->Get(i)); | 1056 self->Set(offset + i, source->Get(i)); |
1057 } | 1057 } |
1058 } | 1058 } |
1059 | 1059 |
1060 return Undefined(args.GetIsolate()); | 1060 return Undefined(args.GetIsolate()); |
1061 } | 1061 } |
1062 | 1062 |
1063 | 1063 |
1064 void Shell::ExternalArrayWeakCallback(v8::Isolate* isolate, | 1064 void Shell::ExternalArrayWeakCallback(v8::Isolate* isolate, |
1065 Persistent<Value> object, | 1065 Persistent<Object>* object, |
1066 void* data) { | 1066 uint8_t* data) { |
1067 HandleScope scope(isolate); | 1067 HandleScope scope(isolate); |
1068 int32_t length = object->ToObject()->Get( | 1068 int32_t length = (*object)->Get( |
1069 PerIsolateData::byteLength_string(isolate))->Uint32Value(); | 1069 PerIsolateData::byteLength_string(isolate))->Uint32Value(); |
1070 isolate->AdjustAmountOfExternalAllocatedMemory(-length); | 1070 isolate->AdjustAmountOfExternalAllocatedMemory(-length); |
1071 delete[] static_cast<uint8_t*>(data); | 1071 delete[] data; |
1072 object.Dispose(isolate); | 1072 object->Dispose(isolate); |
1073 } | 1073 } |
1074 | 1074 |
1075 | 1075 |
1076 Handle<Value> Shell::Int8Array(const Arguments& args) { | 1076 Handle<Value> Shell::Int8Array(const Arguments& args) { |
1077 return CreateExternalArray(args, v8::kExternalByteArray, sizeof(int8_t)); | 1077 return CreateExternalArray(args, v8::kExternalByteArray, sizeof(int8_t)); |
1078 } | 1078 } |
1079 | 1079 |
1080 | 1080 |
1081 Handle<Value> Shell::Uint8Array(const Arguments& args) { | 1081 Handle<Value> Shell::Uint8Array(const Arguments& args) { |
1082 return CreateExternalArray(args, kExternalUnsignedByteArray, sizeof(uint8_t)); | 1082 return CreateExternalArray(args, kExternalUnsignedByteArray, sizeof(uint8_t)); |
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2235 } | 2235 } |
2236 | 2236 |
2237 } // namespace v8 | 2237 } // namespace v8 |
2238 | 2238 |
2239 | 2239 |
2240 #ifndef GOOGLE3 | 2240 #ifndef GOOGLE3 |
2241 int main(int argc, char* argv[]) { | 2241 int main(int argc, char* argv[]) { |
2242 return v8::Shell::Main(argc, argv); | 2242 return v8::Shell::Main(argc, argv); |
2243 } | 2243 } |
2244 #endif | 2244 #endif |
OLD | NEW |