OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 v8::Handle<v8::String> key = v8::String::New(fastSetFlagName); | 51 v8::Handle<v8::String> key = v8::String::New(fastSetFlagName); |
52 global->SetHiddenValue(key, v8::Boolean::New(true)); | 52 global->SetHiddenValue(key, v8::Boolean::New(true)); |
53 | 53 |
54 String source(reinterpret_cast<const char*>(V8ArrayBufferViewCustomScript_js
), | 54 String source(reinterpret_cast<const char*>(V8ArrayBufferViewCustomScript_js
), |
55 sizeof(V8ArrayBufferViewCustomScript_js)); | 55 sizeof(V8ArrayBufferViewCustomScript_js)); |
56 v8::Handle<v8::Script> script = v8::Script::Compile(v8String(source)); | 56 v8::Handle<v8::Script> script = v8::Script::Compile(v8String(source)); |
57 script->Run(); | 57 script->Run(); |
58 } | 58 } |
59 | 59 |
60 | 60 |
61 void copyElements(v8::Handle<v8::Object> destArray, v8::Handle<v8::Object> srcAr
ray) | 61 void copyElements(v8::Handle<v8::Object> destArray, v8::Handle<v8::Object> srcAr
ray, uint32_t offset) |
62 { | 62 { |
63 v8::Handle<v8::String> key = v8::String::New("set"); | 63 v8::Handle<v8::String> key = v8::String::New("set"); |
64 v8::Handle<v8::Function> set = destArray->Get(key).As<v8::Function>(); | 64 v8::Handle<v8::Function> set = destArray->Get(key).As<v8::Function>(); |
65 v8::Handle<v8::Value> argument = srcArray; | 65 v8::Handle<v8::Value> arguments[2]; |
66 set->Call(destArray, 1, &argument); | 66 int numberOfArguments = 1; |
| 67 arguments[0] = srcArray; |
| 68 if (offset) { |
| 69 arguments[1] = v8::Uint32::New(offset); |
| 70 numberOfArguments = 2; |
| 71 } |
| 72 set->Call(destArray, numberOfArguments, arguments); |
67 } | 73 } |
68 | 74 |
69 } | 75 } |
OLD | NEW |